Skip to main content

Running Multiple Rails Server Instances Locally

Chris Oliver August 13, 2013

Another great post by @rncrtr talks about running multiple versions of the Rails webserver locally. It can be useful for many different things, for example, if you want to test to see if your load balancer is working properly. You can find his original post at his website.

If you are developing more than one rails project at the same time, or just don’t want to change directories and restart the server constantly, here’s how to start more than one instance.

Normally, rails runs on port 3000, and is started like this:

# "rails s" is the same thing as "rails server"
rails s

Then you load http://localhost:3000 in the browser.

Starting another server instance is as easy as running it on another port, like this:

# The -p option specifies the port, in this case we chose 3001
rails s -p 3001

This works for most web servers, WEBrick (the default), thin and others. Be sure to visit the right address when you load your second app in the browser, which will be located at http://localhost:3001.

Rn Crtr
Rn Crtr is the author of devderp.com.

P.S. You might enjoy following me on Twitter.


Loading...

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.