So why 3000?

43 views
Skip to first unread message

Jonathan Haar

unread,
Sep 17, 2014, 3:23:29 PM9/17/14
to rubyonra...@googlegroups.com
Why does the rails server default to port 3000? 

Frederick Cheung

unread,
Sep 18, 2014, 11:07:49 AM9/18/14
to rubyonra...@googlegroups.com


On Wednesday, September 17, 2014 8:23:29 PM UTC+1, Jonathan Haar wrote:
Why does the rails server default to port 3000? 

It's been like that since the first commit (https://github.com/rails/rails/commits/4fb6ed4c1c35ba055df36602e3d75b68e7fcb212/railties/dispatches/dispatch.servlet) so I expect you'd have to ask the man himself.

Fred 

Jason Fleetwood-Boldt

unread,
Sep 18, 2014, 11:11:40 AM9/18/14
to rubyonra...@googlegroups.com

On most *nix systems, listening on a port below 1024 requires super-user (root) access. All the ports above 1024 do not, removing the need to execute the ruby command using root access. 

As far as why 3000 specifically, I don't believe it has any particular significance, although you'd have to research back to the early days of Rails to know if there was a specific compelling reason this port was chosen as the default. 

Typically you only use that in development, because in a production environment you will have a web server like nginx that will operate on the normal web port (80)

-Jason

Ganesh Ranganathan

unread,
Sep 18, 2014, 11:18:57 AM9/18/14
to rubyonra...@googlegroups.com

On Thu, Sep 18, 2014 at 12:53 AM, Jonathan Haar <jona...@peoplepattern.com> wrote:
Why does the rails server default to port 3000? 

​Because DHH decided so, that's why​!

Reply all
Reply to author
Forward
0 new messages