19
[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")

Jason
  • 12,229
  • 20
  • 51
  • 66
  • 1
    I haven't seen a config file for WEBric. But you can always create small script that starts the server on the port you want and check the script in your source control repository. – Augusto Sep 12 '11 at 10:25
  • 2
    Please check this. http://stackoverflow.com/questions/3842818/how-to-change-rails-3-server-default-port-in-develoment – HiteshRawal Sep 12 '11 at 11:06
  • Check this out http://www.nearinfinity.com/blogs/chris_rohr/configuring_webrick_to_use_ssl.html – Mahesh Sep 12 '11 at 10:59

2 Answers2

26

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
Community
  • 1
  • 1
Salil
  • 46,566
  • 21
  • 122
  • 156
1

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

 #!/bin/bash
 rails server -p 3001
Simpleton
  • 6,285
  • 11
  • 53
  • 87