Forum: Ruby Changing port for WEBrick ???

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
B2561fdd05855be51aca982c54eb9f81?d=identicon&s=25 John N. Alegre (Guest)
on 2006-02-18 20:45
(Received via mailing list)
After working with rails code I have decided that WEBrick would be quite
usefull for serving documents to a local LAN.  To that end I want to
have
WEBrick listen over a different port for each set of documents I need to
serve.  I am just using the stock Rails framework here and starting
WEBrick
with

libros ~%script/server.

How can I change the port form 3000 to something else ... say 3020.  I
have
tried putting

server.port=3020

in either config/environment.rb or config/environments/production.rb and
starting WEBrick with

libros ~%script/server --environment=production

It always comes up listening on port 3000.  Naturally I do not want to
modify the default lighttpd.conf file

How can I do this? All help welcomed.

Thanks.
921432719b51a266a06878ff4128a7b1?d=identicon&s=25 Dae San Hwang (Guest)
on 2006-02-18 20:51
(Received via mailing list)
I think you should post rails related questions to
rails@lists.rubyonrails.org

Try "server webrick -p3020".

daesan
2ea2840648beec7d5510cdeebd3a9a66?d=identicon&s=25 Shashank Date (Guest)
on 2006-02-18 20:57
(Received via mailing list)
Hi,

"John N. Alegre" <info@johnalegre.net> wrote:
How can I change the port form 3000 to something else ... say 3020. I
have
tried putting

server.port=3020


  -----------------------------------
  C:\_Rails\presentror>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.

  C:\_Rails\presentror>ruby script/server --port=3020
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3020
=> Ctrl-C to shutdown server; call with --help for options
[2006-02-18 13:54:41] INFO  WEBrick 1.3.1
[2006-02-18 13:54:41] INFO  ruby 1.8.2 (2004-12-25) [i386-mswin32]
[2006-02-18 13:54:41] INFO  WEBrick::HTTPServer#start: pid=5948
port=3020
This topic is locked and can not be replied to.