Rails

Running Rails Server on a Port Other Than 3000

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. Specifying the IP address is because if you don't specify this and only specify the port, it will only be available on <code>localhost</code>...

Shou Arisaka
1 min read
Nov 20, 2025

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.

Share this article

Shou Arisaka Nov 20, 2025

🔗 Copy Links