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.

Michael Glaesemann
grzm seespotcode net

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 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