Intermittent 500 errors with Nginx reverse proxy for Apache PHP FPM

Steve Holdoway steve at greengecko.co.nz
Thu Feb 12 02:10:00 UTC 2015


If the apache access logs are showing a 500, then it's pointing to a PHP
problem isn't it??? What's in the php-fpm logs?

BTW if you're running php as fpm, why are you using apache at all? I
certainly don't.

Cheers,


Steve

On Wed, 2015-02-11 at 16:07 -0800, neubyr wrote:
> 
> 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
> 
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

-- 
Steve Holdoway BSc(Hons) MIITP
http://www.greengecko.co.nz
Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa



More information about the nginx mailing list