hackstar15
hackstar15

Reputation: 1489

Why do you need nginx with passenger for RoR?

I know that nginx is a web server, and passenger is an app server. We can just run

passenger start

to start up our rails application, and everything seems to work fine. But there are a lot of posts about setting up nginx as a reverse proxy.

It would be helpful if an expert on this broke down each component, and explain why need nginx and passenger together, and the role of each.

Questions for thought:
- What is the main purpose of wrapping the passenger around nginx, as opposed to running passenger standalone?
- Is it bad to just run passenger standalone?
- Does running "passenger start" boot up its own nginx server?

Upvotes: 6

Views: 2457

Answers (2)

Hongli
Hongli

Reputation: 18944

All your questions are answered in the official Passenger documentation.

Upvotes: 6

dimakura
dimakura

Reputation: 7655

I'm not an expert of web-servers, though I always deploy my Rails apps with Passenger behind Apache/Nginx.

Let me just list several advantages of this approach (there might be more options and reasons for doing it):

  1. Passenger is a standalone server. It means, it was designed to run on a single machine. You can't balance working of two passenger servers the way you can with Apache/Nginx.
  2. You can run only single application on given machine with Passenger.
  3. Static assets management can be done with Nginx, without ever hitting passenger.
  4. It's very easy for an attacker to make your site unresponsive by sending too many request. Nginx/Apache gives you ability to block certain IPs.

Upvotes: 0

Related Questions