Blog / Running Multiple Rails Server Instances Locally

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.


Comments
Loading...

Want to stay up-to-date with Ruby on Rails?

Join 35,095+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.