Intermittent 500 errors with Nginx reverse proxy for Apache PHP FPM

neubyr neubyr at gmail.com
Thu Feb 12 00:07:05 UTC 2015


I have Nginx as reverse proxy in front of Apache. Nginx is handling most of
the redirects and static content. Apache is handling PHP requests using
fastcgi php-fpm. This setup is giving intermittent 500 errors, however,
there are no errors when Apache is serving traffic directly.

Below are some key parameters:
 * Apache is using worker MPMs.
  ServerLimit          2048
  ThreadLimit           100
  StartServers           10
  MinSpareThreads        30
  MaxSpareThreads       100
  ThreadsPerChild        64
  MaxClients           2048
  MaxRequestsPerChild  5000

Nginx is using 2 worker processes and worker_connections is 1024. Proxy
connections are configured using proxy_pass and not upstream.


Keep-alive is disabled on both Apache and Nginx.

Apache access logs show 500 return code, but apache error logs don't
contain any information. php-fpm logs are empty as well.


Nginx debug logs indicates:

2015/02/10 21:21:39 [debug] 10657#0: connect to 127.0.0.1:8080, fd:60 #50
2015/02/10 21:21:39 [debug] 10657#0: *49 http upstream connect: -2
2015/02/10 21:21:39 [debug] 10657#0: *49 posix_memalign:
000000000129B290:128 @16
2015/02/10 21:21:39 [debug] 10657#0: *49 event timer add: 60:
60000:1423632159180
2015/02/10 21:21:39 [debug] 10657#0: *49 http finalize request: -4,
“/reviews/truelist?” a:1, c:2
2015/02/10 21:21:39 [debug] 10657#0: *49 http request count:2 blk:0
2015/02/10 21:21:39 [debug] 10657#0: *49 post event 00000000012516A8
2015/02/10 21:21:39 [debug] 10657#0: *49 post event 0000000001251710
2015/02/10 21:21:39 [debug] 10657#0: *49 delete posted event
0000000001251710
2015/02/10 21:21:39 [debug] 10657#0: *49 http upstream request:
“/reviews/truelist?”
2015/02/10 21:21:39 [debug] 10657#0: *49 http upstream send request handler
2015/02/10 21:21:39 [debug] 10657#0: *49 http upstream send request
2015/02/10 21:21:39 [debug] 10657#0: *49 chain writer buf fl:1 s:369
2015/02/10 21:21:39 [debug] 10657#0: *49 chain writer in: 000000000129C1D8
2015/02/10 21:21:39 [debug] 10657#0: *49 writev: 369
2015/02/10 21:21:39 [debug] 10657#0: *49 chain writer out: 0000000000000000
2015/02/10 21:21:39 [debug] 10657#0: *49 event timer del: 60: 1423632159180
2015/02/10 21:21:39 [debug] 10657#0: *49 event timer add: 60:
60000:1423632159181
2015/02/10 21:21:39 [debug] 10657#0: *49 delete posted event
00000000012516A8
2015/02/10 21:21:39 [debug] 10657#0: *49 http run request:
“/reviews/truelist?”
2015/02/10 21:21:39 [debug] 10657#0: *49 http upstream check client, write
event:1, “/reviews/truelist”
2015/02/10 21:21:39 [debug] 10657#0: *49 http upstream recv(): -1 (11:
Resource temporarily unavailable)
2015/02/10 21:21:39 [debug] 10657#0: post event 00000000012362B0



Another thing I noticed is that http.workers have dropped from 30-40
workers to 2 workers with nginx. When Apache is serving traffic without
Nginx, there are no 500 errors, but it has more workers active.



Any pointers on debugging 500 errors will be really helpful.


--
Thanks,
N
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150211/d918ae99/attachment.html>


More information about the nginx mailing list