Passenger recently got support for Nginx, what are the pros and cons of it over Apache as a web server for Rails applications?
2 Answers
Nginx is far more lightweight, taking up less memory and other resources. On the other hand, Apache has more esoteric modules, built-in support for many more things, and is more widely used, both in general (so more docs and blog posts on using it for different tasks) and with Passenger (and so more of the kinks will have been found and fixed already).
On a more subjective level, I find nginx's config file format to be easier to work with and it's request processing model more intuitive.
![](../../users/profiles/1375.webp)
- 95,029
- 29
- 173
- 228
Here's a con to NGINX:
While I'm getting used to NGINX, I would say I'm surprised at how often I need to restart the NGINX server when configuring rewrite rules and creating new directories for applications, etc...
That said, I just set up Passenger, Ruby Enterprise Edition, and Nginx on a VPS with 360 MB of ram. I have limited experience with Apache in a shared hosting environment a couple of years ago. Apache's .htaccess files, if I recall correctly, seemed to be more dynamic. The lack of dynamic configuration seems to be not a problem since the VPS is mine.
![](../../users/profiles/13944.webp)
- 599
- 4
- 4