Dear perusio, using your full setup with a few modifications, i get a super lightning fast site, but in some parts of it i receive 502 errors (which i don't get with plain install). my setup is nginx+php-fpm+apc+boost, and by using included drupal_boost the site loads fine, but goes bork in:
Can you provide a debug log tracing the requests that generate the 502? Paste it here or in a paste bin somewhere.
I am also getting seemingly random 502 Bad Gateway errors.
I'm using upstream_phpcgi_unix.conf and have only modified the names of the sockets (I changed them from zwei... to zero, one and two).
My error log is showing errors like the following
2012/05/12 06:01:01 [error] 18024#0: *1303790 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 18.104.22.168, server: megagames.com, request: "GET /admin/content/orphan-game-entries HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm-zero.sock:", host: "megagames.com", referrer: "http://megagames.com/admin/content"
2012/05/12 06:01:01 [error] 18024#0: *1303790 no live upstreams while connecting to upstream, client: 22.214.171.124, server: megagames.com, request: "GET /admin/content/orphan-game-entries HTTP/1.1", upstream: "fastcgi://phpcgi:", host: "megagames.com", referrer: "http://megagames.com/admin/content"
In most cases, only the first error occurs. In these cases, if it's only a connection reset, the page loads fine -- I'm assuming that's because nginx falls over to another socket which succeeds.
In the case where the second error occurs, you can see that the socket is in fact wrong:
This is a non existent socket, and in fact nginx croaks here with the 502. Hitting refresh in the browser will then load the page successfully, I'm assuming, again, because nginx gets a good unix socket on the following attempt.
My Nginx was not compiled with debug log enabled, and we're live now, so I can't recompile to run a trace, unfortunately.
Try to edit your upstream and comment keepalive.
Edit your nginx servers and comment fastcgi_keep_conn.
This fixed it for me.
@perusio this issue seems to be still happening with the actual configuration.
The solution proposed by @Fidelix at #35 (comment) fixed it for me.
Unfortunately, I troubleshooted this issue for months. Literally months. I modified just about every parameter (good forum here about related possible issues: https://groups.drupal.org/node/229898#comment-1072193 ) .... Ultimately, I had to resort to turning off keep alive connections (comment fastcgi_keep_conn like @Fidelix mentions). I wish I could have taken advantage of this feature of Nginx, but I just can't get it worked out. I can post further logs here; @aaroncraig pretty much nailed exactly what my issues always are (same log errors too). And same description of how it always happened too where refresh is fine because nginx connects again to a new worker I presume.
Please check to make sure you are not enabling opcache.so or any other cache twice.