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.

  • tnx to martin and webdestroya answers, now i'm leaning towards nginx
    – mhd
    May 21, 2010 at 4:26
  • Wouldn't it make more sense to go with a specifically designed reverse proxy like varnish?
    – ptman
    May 21, 2010 at 5:45

5 Answers 5


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.

  • +1 for the clarification. May 19, 2010 at 8:58
  • 1
    I would go so far as to reccomend it as your sole web server. see my comments serverfault.com/questions/133481/… <-- here. I'm using it as the only web server on my VPS, and I've gotten the other users on board with FastCGI for their PHP/CGI apps.
    – Jason
    May 20, 2010 at 0:46
  • Jason I've been using it as my sole web server for over a year now and it handles millions of page loads a day. I fully agree with your recommendation! :) May 20, 2010 at 2:26

NGinX. This server is known to be one of the best performing web servers, and is used by many different companies (Notable, MediaTemple)

Easiness of Config:
Apache. Apache's config is really simple, and really powerful. Nginx is powerful, but can be very hard to understand, as it seems more like a programming language than a config file.

Level of Customization:
Apache. Apache has tons of mods and other plugins written for it. While Nginx still has plugins made for it, I think that Apache has many many more than Nginx does.

For Ruby:
I know Nginx can be used as a powerful load balancer with Mongrel/webrick. However, Apache has Phusion/Passenger which makes the integration nicer.

Reverse Proxy Winner:

  • 2
    I'm interested, not arguing. Why is Nginx a winner for reverse proxy? The rest of your answer doesn't really make one stand out from the other. If anything it tends to favour Apache. May 19, 2010 at 5:49
  • 1
    Well, because for the most part, you want a reverse proxy due to high load. Which would mean performance is probably the biggest issue, in which case Nginx was the winner which is why I chose it. As a developer, I love apache, but from a "how can i get the most performance from this web server" point, i would go with Nginx May 19, 2010 at 18:17
  • Not sure what it was like back, in 2010, but NGINX documentation now has pretty clear configuration examples/tutorials, e.g. for web-server and reverse-proxy configuration.
    – djvg
    Dec 4, 2020 at 12:13

Nginx is event-based, while apache is process-based. Under high load, this makes all the difference in the world... Apache has to fork or start a new thread for each connection, while nginx doesn't. This difference shows up mainly in memory usage, but also in user response time and other performance metrics. Nginx can handle tens of thousands of simultaneous HTTP keepalive connections on modern hardware. Apache will use 1-2 MB of stack for each connection, so doing the math you see that you can only handle a few hundred or maybe a thousand connections simultaneously without starting to swap.

We use nginx in front of Apache and IIS in our environment as a load-balancing and caching proxy, and couldn't be happier. We use two small-ish nginx boxes in place of a pair of very expensive leased F5 devices and our sites are far faster in both feel and measured response times.


I’ve had serious problems with Apache’s mod_proxy on a variety of platforms in various different environments over the last couple of years. From time to time, it will simply stop working and the only cure seems to be to restart the Apache server.

Personally, I’d not be asking “nginx vs Apache”, but “nginx vs lighttpd” — and that’s a far tougher call!

  • Valid argument, but last time I checked, lighttpd still had long outstanding bugs and was renowed for memory leaks. It was advised against for production deployment by admins. Has this changed? May 19, 2010 at 12:58
  • It has caveats, certainly (especially where serving very large files), but it’s significantly more stable than Apache as a proxy - I’ve had no real problems in several deployments in the last six months
    – Mo.
    May 19, 2010 at 16:13
  • I have written off lighttpd from candidate list for some forgotten reason :)
    – mhd
    May 21, 2010 at 4:23

I was in the same dilemma as You about two weeks ago.

To give You a really terse answer: From my research nginx is really fast and resource friendly, but it was only concieved to reverse proxy static files. The rest are bolt on solutions which You have to configure or script Your way around.

AFAIK nginx has no htaccess files so You have to find Your way around if depending on that feature.

AFAIK everything needed works and I've seen tutorials.

I will go with nginx with my testing and profiling setup. I have a typical LAMP application.

I have read that there are people who reverse proxy and serve static files from nginx and pass everything else like PHP to a running Apache instance. They claim a good tradeoff. I have no performance data about that, but You might want to know.

  • 2
    Disabling htaccess overrides on apache for performance reasons is fairly common, supporting such a feature in a server designed for high performance wouldn't make much sense. May 19, 2010 at 11:02
  • Thanks for adding that statement. The OP is no pro admin, so we need to be clear. May 19, 2010 at 12:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .