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

I have my website built with django running on an apache server and I want to install nginx for static file serving. Do you think there is any considerable difference if i put nginx on port 80 and proxy requests to apache, or leave apache on port 80 and proxy requests to nginx. Why I ask is because I would rather leave apache on 80 because I have cpanel on my webserver and changing apache port would be more complicated.

share|improve this question

migrated from stackoverflow.com Aug 24 '10 at 11:35

This question came from our site for professional and enthusiast programmers.

1 Answer 1

Create an IP alias on your primary interface, bind httpd to the main address, and bind nginx to the alias address.

share|improve this answer
    
Is there any advantage to doing this? I know I can use nginx as a front-end and I believe I can use apache as front-end also and nginx serving static files on another port and I could just proxy requests from apache to nginx. Another IP address would just cost more. –  Virgil Balibanu Aug 24 '10 at 14:38
1  
The advantage is that you wouldn't have to proxy the requests. Proxying has a non-zero cost itself. –  Ignacio Vazquez-Abrams Aug 24 '10 at 21:16
    
How can I do this? I mean don't I have to use something la proxy just to the other ip on port 80? Can you please give me a line doing this, so I could understand how you do it? –  Virgil Balibanu Aug 25 '10 at 10:27
    
Add a second DNS entry (e.g. static.example.com) pointing to the alias address, then change the media URL to that name. –  Ignacio Vazquez-Abrams Aug 25 '10 at 10:41
1  
ah, that would Imply I go through all sources and change the domain for everything that is static, like having it on another server –  Virgil Balibanu Aug 25 '10 at 11:01

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.