A memo on how to run the server and execute the rails s / rails server command on a port other than 3000 in Ruby on Rails.
To run on port 3001:
rails s -b 0.0.0.0 -p 3001
The reason for specifying the IP address with -b is that if you don’t specify this and only specify the port, it will only be available on localhost. (Rails 5.2)
If you want to connect with a local address like 192.168.1.1, specify 0.0.0.0.
Also, when going through virtualbox or similar, don’t forget to add port forwarding settings, which is easy to overlook.