Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start WEBrick in a different port than 3000

[2011-09-11 06:14:12] INFO  WEBrick::HTTPServer#start: pid=32723 port=3000

How to start WEBrick in a different port than 3000, is there a way to specify this information in a config file instead of the command line argument ("-p")

like image 586
Jason Avatar asked Sep 12 '11 09:09

Jason


People also ask

How do I run a Rails project on a different port?

Go to your browser and open http://localhost:3000, you will see a basic Rails app running. You can also use the alias "s" to start the server: bin/rails s . The server can be run on a different port using the -p option.

How do I stop a running rails server?

One way to shut down a rogue server is with the kill command. For the PID output above, you could kill the corresponding stuck server using kill 42612 . And if that didn't work, you could try kill -9 42612 .


2 Answers

Use -p parameter

For Rails 2

ruby script/server -p3001

and for w/o command line ref this

EDITED For Rails 3

rails s -p3001
like image 179
Salil Avatar answered Oct 20 '22 01:10

Salil


If you wanted to run on port 3001, add this bash script:

 #!/bin/bash
 rails server -p 3001
like image 25
Simpleton Avatar answered Oct 19 '22 23:10

Simpleton