Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

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 Aug 19 '11 at 17:47

This question came from our site for pro webmasters.

I would try to ask this question on 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

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

share|improve this answer

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

Your Answer


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