Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm setting up a Django server with Apache + mod___wsgi and nginx as a static media server.

Which server should I put in front of the other? Apache using mod___proxy or nginx? I've heard different people say different things.

From what I understand, putting nginx in front is slightly faster, but I lose the ability to use .htaccess files and mod_rewrites. It's also slightly more complex to set up.

Is this correct? Lets discuss :-)


I've heard that the proxying taking place in either apache or nginx is so cheap, it really doesn't matter which server does it. That apache doesn't "waste" any resources until proxying is done. I'm really trying to get my head around this stuff, I'm really a coder :P

share|improve this question
HD: Did you provide a link to proxy_pass? Is it a configuration option in nginx or apache? – jamting Sep 27 '09 at 21:00
It's a nginx directive. I edited my answer with the link. – HD. Sep 29 '09 at 13:49
up vote 2 down vote accepted

You can put nginx in front of Apache and [proxy_pass][1] all the non-static requests with the ability to use apache's mod_rewrite. It works and is very easy to setup.

Another option is to put both servers at the same level using a different domain or subdomain for static files pointing to the nginx server.

Apache in front of nginx ... I will not use it. What we need in these setups is reduce the load and memory use of the Apache server, so nginx in front or at the same level are the best choices.


proxy_pass directive in nginx:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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