Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run Rails 3 application on localhost/<my_port>?

To run Rails application on Windows I do:

  • cd < app_dir >
  • rails server

I see the following:

=> Booting WEBrick
=> Rails 3.0.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-01-12 20:32:07] INFO  WEBrick 1.3.1
[2011-01-12 20:32:07] INFO  ruby 1.9.2 (2010-08-18) [i386-mingw32]
[2011-01-12 20:32:07] INFO  WEBrick::HTTPServer#start: pid=5812 port=3000

Question 1

Why port 3000 is selected ? Where is it configured ?

Question 2

How could I run 2 applications in parallel ? I guess I need to configure one of them to be on other port (like 3001). How should I do this ?

like image 385
Misha Moroshko Avatar asked Feb 25 '23 09:02

Misha Moroshko


1 Answers

Port 3000 is the default for webrick in rails. To change the port, you can just run rails server -p 3001.

Run rails server -h for a list of all the arguments it can take.

like image 69
idlefingers Avatar answered Mar 11 '23 19:03

idlefingers