0

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 :-)

Clarification:

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

Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151
jamting
  • 103
  • 4

1 Answers1

2

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.

UPDATE

proxy_pass directive in nginx: http://wiki.nginx.org/NginxHttpProxyModule#proxy_pass

hdanniel
  • 4,293
  • 23
  • 25