Colin Dean
Colin Dean

Reputation: 1579

What are the differences between using `rails server` and `rackup`?

The only difference I've noted is that rails server starts the server on port 3000, while rackup starts the server on port 9292.

Are there any other differences?

Are there use cases for one instead of the other?

Upvotes: 9

Views: 4729

Answers (1)

Gazler
Gazler

Reputation: 84190

rails server is the command for starting your server (usually WEBrick) and is in rails.

rackup is a command that comes with the rack middle and uses the settings in your config.ru and starts a server based off of those. This is a standard (it will work for other frameworks and rack-based applications) and is usually used in production servers.

One difference of note is that if you start a server with rails s then you will see the output in the terminal.

In my experience, in production, rackup is used by phusion passenger so you wouldn't want rails s in that situation.

As an aside, the port can be changed with both rails server and rackup using the -p flag.

Upvotes: 18

Related Questions