I know there are lot of tutorials out there which suggest the use either nginx or lighttpd on port 80 and proxy dynamic requests to apache running on a different port. I am not ready to take that leap yet for my VPS. However I could definitely try the reverse scenario.

i.e. use apache's mod_proxy to proxy requests to nginx/lighttpd running on a different port.

But does that even make sense? will there be a performance gain if I use the reverse setup?


No. The performance on that is pretty much guaranteed to be significantly worse than just serving the static content out of Apache.

Furthermore, I don't think the performance gains to be had (if any) from serving static content from nginx outweigh the downsides of proxying dynamic requests back to Apache -- that is to say, the "conventional wisdom" embodied in the "lot of tutorials" is just plain wrong, stupid, and generally unnecessary (who would have thought it -- bad information on the Internet?). I'd be willing to wear the idea of using nginx to serve static assets from a separate assets domain, on a separate IP (even if it's on the same box), but I don't think proxying webserver to webserver makes sense.

  • Eek, I might have had the right initial impulse, to call this one subjective. For what it's worth, I completely agree that using a "lighter" web server as a reverse proxy at all times as standard practice should be burned from our collective "conventional wisdom", and that there's very rarely an excuse for it from a performance perspective. I just felt the need to give my answer a qualifier in the form of "but, in this insane edge-case, it could make sense." – Shane Madden Aug 1 '11 at 6:06
  • 1
    Substitute "subjective" for "busted". Preference given to demonstrations where something gets blown up. – womble Aug 1 '11 at 6:09
  • I can get behind that. – Shane Madden Aug 1 '11 at 6:14
  • I agree, putting nginx on the front proxying back to Apache makes no sense. I will however point out that nginx performs quite better on the same hardware and it scales higher COMPARED to Apache :-) – pauska Aug 1 '11 at 6:24
  • Well, someone put a down-vote on both answers, so I guess we've got some proponents of the single-node reverse proxy architecture around here somewhere. @pauska There's that subjectivity again ;). – Shane Madden Aug 1 '11 at 6:34

This is a very uncommon setup, I've never heard about anyone using nginx/lighttpd as a backend. It doesn't make sense, as you want the front-end to be the absolutely fastest point for serving static files (nginx, lighttpd) or caching both static and dynamic (varnish etc).

If you're really bound to use Apache as a front-end then just keep it.

  • Its not that uncommon, if you search for it on google, various blog posts claiming its performance benifits, but didn't make sense to me, thats why the query – freethinker Aug 1 '11 at 11:48
  • Yes, you'll get results from google, same as you would if you search for "how to eat poop".. I think you get my point :) – pauska Aug 2 '11 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.