The solution is running the code below to start your server:
rails s -b 0.0.0.0
I found this solution from another post about same problem.
The answerer said ‘You’ll want to make sure that the server is binded to 0.0.0.0 so that all interfaces can access it.”
I hope this post helps people who encounter the same problem 🙂