Monday, August 21, 2006

Starting Webrick on a different port

Often you may need to start webrick on a different port. Luckily, you can do so using the -p options.

[root@srv31 ror]# ruby script/server -p 9191
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:9191
=> Ctrl-C to shutdown server; call with --help for options
[2006-08-21 13:45:37] INFO WEBrick 1.3.1
[2006-08-21 13:45:37] INFO ruby 1.8.4 (2005-12-24) [i686-linux]
[2006-08-21 13:45:37] INFO WEBrick::HTTPServer#start: pid=4812 port=9191


For more help options use the --help option:

[root@srv31 ror]# ruby script/server --help
=> Booting WEBrick...
Usage: ruby server [options]

-p, --port=port Runs Rails on the specified port.
Default: 3000
-b, --binding=ip Binds Rails to the specified ip.
Default: 0.0.0.0
-e, --environment=name Specifies the environment to run this server under (test/development/production).
Default: development
-m, --mime-types=filename Specifies an Apache style mime.types configuration file to be used for mime types
Default: none
-d, --daemon Make Rails run as a Daemon (only works if fork is available -- meaning on *nix).
-c, --charset=charset Set default charset for output.
Default: UTF-8

-h, --help Show this help message.

8 Comments:

At 6:37 AM, Blogger animeworld said...

thanks!!!

this is very interesting!

 
At 10:32 PM, Blogger Raja Trip said...

How to run ruby server with use many port ?
For example, i want to run ruby server on port 3001-3010. Thank you.

 
At 10:29 AM, Blogger DSimon said...

Christeddy, you'll have to use a firewall to do that. If you're on Linux, you can use an iptables NAT redirection to pull that off fairly easily.

 
At 11:27 PM, Blogger atin said...

thanx

 
At 11:27 PM, Blogger atin said...

thanx

 
At 8:53 AM, Blogger kik13 said...

what is the syntax for multiple options?

 
At 3:49 AM, Blogger Unknown said...

Easy to set up web alternatives using
Ruby on Rails as it works well with broad range of web servers and directories that apply CGI or Fast SGI.

 
At 3:21 AM, Blogger Tejuteju said...

Really nice blog post. provided a helpful information. I hope that you will post more updates like this Ruby on Rails Online Course Hyderabad


 

Post a Comment

<< Home

eXTReMe Tracker