Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

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
add comment

1 Answer 1

up vote 1 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.

UPDATE

proxy_pass directive in nginx: http://wiki.nginx.org/NginxHttpProxyModule#proxy%5Fpass

share|improve this answer
add comment

Your Answer

 
discard

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.