Nginx vs Apache – Which is Better as a Reverse Proxy?

apache-2.2nginxreverse-proxy

this kind of question maybe has been asked here
but I couldn't find any that really match my question.
Heard that nginx performance is quite impressive,
but Apache has more docs, community(read:expert) to get help

Now what I want to know,
how both web servers compare
in term of performance, easiness of config, level of customization,etc.
AS REVERSE PROXY server in a vps environment??

I'm still weighing between the two for a ruby web app(not ROR) served with
thin (one of ruby web server).

Specific answer will be much appreciated.
General answer not touching the ruby part is okay.
I'm still noob in web server administration.

Best Answer

I wanted to put this in a comment since I agree with the most important point of webdestroyas answer, but it got a bit too long.

You're in a VPS environment, this means you're most likely going to be low on RAM. For this reason alone you'll want Nginx as its memory footprint is smaller than Apaches.

Also I do not agree with some of the arguments mentioned.

Easiness of Config:
Nginx is not more difficult than Apache. It's different. If you're used to Apache then change will always be more difficult, this does not mean that the configuration style itself is more difficult. I migrated completely from Apache to Nginx over a year ago and today I would struggle to configure an Apache server whereas I find Nginx extremely easy to configure.

For Ruby:
Nginx has Passenger, however, I usually see it described as the inferior method to connect to Ruby. I am not a Ruby programmer so I cannot verify this but I often see Unicorn and Thin mentioned as better alternatives.

In Conclusion:
Nginx was made to be a reverse proxy. Initially all it did was serve static files and reverse proxy to a backend server via HTTP/1.0. Since then fastcgi, load balancing and various other features has been added, but it's initial design purpose was to serve static files and reverse proxy. And it does this really well.

Apache, on the contrary is a general purpose web server. I have no doubt that it can reverse proxy perfectly fine, but it was not designed to have a minimal memory footprint and as a result it requires more resources than Nginx does, which means my initial VPS environment argument comes into play.