I'm trying to make a reverse proxy from nginx to apache on my Ubuntu 10.04 server. It is working fine right now with HTML files... the requests are sent directly to apache. But whenever I visit a PHP file, I see a nginx
502 bad gateway error. I'm guessing this means that there's a problem with apache's PHP configuration.
Here's the message I get from the nginx error log:
2012/01/02 09:48:06 [error] 27834#0: *2445 upstream prematurely closed connection while reading response header from upstream, client: myIP, server: mydomainname, request: "GET /phpsite/ HTTP/1.1", upstream: "http://127.0.0.1:8090/phpsite/", host: "mydomainname"
Is my nginx/apache config incorrect? If so, how should I add PHP to it?
Edit: I fixed it! Apparently PHP installed two plugins for caching (apc and XCache) which interfered with each other. In the php log file I found out about this:
PHP Warning: Cannot load module 'XCache' because conflicting module 'apc' is already loaded in Unknown on line 0
I removed apc and restarted apache. Now it works fine.