Why do you need nginx with passenger for RoR?
Asked Answered
E

2

6

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?

Expansive answered 26/9, 2015 at 19:46 Comment(0)
U
6

All your questions are answered in the official Passenger documentation.

Unprejudiced answered 30/9, 2015 at 5:51 Comment(1)
FYI: Hongli is the Co-founder of Phusion, developer of the Passenger application - github.com/FooBarWidgetBrutish
D
0

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.
Defroster answered 26/9, 2015 at 20:17 Comment(1)
Passenger author here. 1) This is not true, you can load balance things between Passenger instances just fine. Use any standard HTTP load balancer. 2) This is also not true, Passenger is explicitly designed for multitenancy. It is in fact the only Ruby application server with support for multitenancy. 3) Passenger already configures Nginx in such a way that static assets are directly served from Nginx, without hitting Passenger or the app.Unprejudiced

© 2022 - 2024 — McMap. All rights reserved.