1

I host several sites on a CentOS VPS, and all was working fine until one of the WordPress sites on the server started returning a 502 Bad Gateway error. Other sites work fine. The WordPress site will load if I rename the BuddyPress plugin directory, but I am unsure about how to debug what in this plugin is now causing an issue (the plugin was working previously and has not been updated). The exact same code/database will work properly using my local Apache install, so it seems to be specific to the server configuration. Not using this plugin isn't an option, so my question is more about how to debug the server configuration.

My configuration:

  • CentOS 5.10
  • Nginx 1.60
  • PHP 5.5
  • spawn-fcgi 1.6.3

Errors:

  • Browser

    502 Bad Gateway nginx/1.6.0 
  • Nginx/PHP error log

    2014/06/28 19:40:13 [error] 8146#0: *22994 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: *.example.com, request: "GET / HTTP/1.0", upstream: "fastcgi://127.0.0.1:53217", host: "www.example.com" 2014/06/28 19:40:14 [error] 8146#0: *22980 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 123.123.123.123, server: *.example.com, request: "GET /about/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:53217", host: "www.example.com", referrer: "https://www.example.com/about/" 
  • /var/log/messages

    Jun 28 19:40:13 web1 kernel: php-cgi[27053]: segfault at 000000000000002c rip 00000000005bc798 rsp 00007fffc73f0ae0 error 4 Jun 28 19:40:13 web1 kernel: php-cgi[10559]: segfault at 000000000000002c rip 00000000005bc798 rsp 00007fffc73f0ae0 error 4 Jun 28 19:40:14 web1 kernel: php-cgi[17410] general protection rip:5bc798 rsp:7fffc73f0ae0 error:0 

Things I've tried:

  • Verified spawn-fcgi is running and responding to requests (other sites work)
  • Increased PHP memory in php.ini - even allowing 1GB of memory has the same effect.
  • Set fastcgi buffers in nginx.conf

    fastcgi_buffering on; fastcgi_buffers 8 16k; fastcgi_buffer_size 32k; 

1 Answer 1

1

I finally fixed the issue by setting the following values in nginx.conf for PHP files. The proxy_* entries seemed to do the trick.

proxy_buffer_size 128k; proxy_buffers 4 256k proxy_busy_buffers_size 256k; fastcgi_buffering on; fastcgi_buffer_size 16k; fastcgi_buffers 16 16k; 

Of course after battling this for days I solved the issue less than 10 mins after posting...

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.