On 29 Aug 2007, at 05:55, Michael Glaesemann wrote:
>> Since Mongrel is now built into Rails, Is it possible to change the
>> default port from 3000 to something else?
>
> I''ve searched for a convenient way to configure the default port
per
> app myself (other than using a command line switch). I''ve settled
on
> creating a one-line shell script in RAILS_ROOT:
>
> $ cat server
> script/server -p 3101
>
> I change the port number for each app and can start it with a cd
> and ./server
>
> Not perfect, but it works.
If you want to host your server on the same port every time (but not
the default 3000 one), you can add the following lines to
~/.bash_login (don''t forget to quit the session and start a new one
afterwards):
alias serverd=''sudo script/server -p 80'' # start up the beast
on port
80 (privileged port, so needs sudo)
alias serverp=''sudo script/server -p 80 -e production'' # start
up in
production
You can then just use "serverd" en "serverp" in your Rails
app folder
to start your server.
Now for Michael''s method: you could write a bash script that loops
through ports checking for the first available one, then use that to
start up a mongrel on that available port. The method described at
http://www.bhaskarvk.info/content/unix/bash_tricks.html is a good
start, maybe someone with a bit more bash experience on the list can
tell you how to write the loop and start a mongrel on an available port.
Best regards
Peter De Berdt
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---