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.

Can I use the same Nginx installation as a reverse proxy (for apache+mod_wsgi) and use it to serve static content and PHP over a single IP address at the same time?

share|improve this question

migrated from webmasters.stackexchange.com Aug 19 '11 at 17:47

This question came from our site for pro webmasters.

    
I would try to ask this question on stackoverflow.com. There it's all about servers. I have a few questions on the subject. –  Saif Bechan Aug 19 '11 at 5:05
    
You but you would need to run apache on a different port (ex 81) and forward traffic from nginx to apache on port 81. Plenty of info on the nginx site how to do that. –  Yavor Shahpasov Aug 19 '11 at 18:54
add comment

2 Answers 2

Yes, you can use one nginx instance to serve both static content, dynamic content (by proxying to an FCGI or backend HTTP app server) and a reverse proxy. The configuration is straightforward and covered by the excellent documentation and examples available from http://wiki.nginx.org/.

share|improve this answer
add comment

Using different listen ports and redirecting incoming connections (for e. g., with firewall) properly.

share|improve this answer
    
Is it possible with a single instance of nginx only listening on port 80? –  abarg Aug 19 '11 at 3:51
    
Define what 'single instance of nginx' is? No apache at all, or what? –  poige Aug 19 '11 at 4:03
    
What I meant was a single process, sorry. Actually multiple processes would be fine, but all requests need to come from port 80 –  abarg Aug 19 '11 at 4:39
    
— Well, in conclusion: there's nothing unusual in the scheme of nginx usage you had asked about. –  poige Aug 19 '11 at 5:17
add comment

Your Answer

 
discard

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