502 Bad Gateway

Igor Sysoev is at rambler-co.ru
Wed Aug 22 09:31:52 MSD 2007


On Wed, Aug 22, 2007 at 01:51:17AM +0000, dyna wrote:

> Hello, 
> 
> I seem to be having an issue which I can't track down on my own. I recently
> installed nginx on a xubuntu server. And it's using FastCGI to server PHP.
> However I get 502 Bad Gateway errors currently, instead of it working. 
> 
> It's really odd, because it is an identical configuration to a server that does
> work, or at least I think it's identical. I'm including the info below, any help
> would be great
> 
> 
> ---error.log
> 2007/08/21 21:23:08 [error] 5792#0: *9 recv() failed (104: Connection reset by
> peer) while reading response header from upstream, client: 127.0.0.1, server:
> my.domain.com, URL: "/index.php", upstream: "fastcgi://127.0.0.1:8003", host:
> "localhost"
> 
> ---nginx config
> location ~ .*\.php$ { 
>   include conf/fcgi.conf;       
>   fastcgi_pass  127.0.0.1:8003;
>   fastcgi_index index.php;
>   fastcgi_param SCRIPT_FILENAME /var/www/my.domain.com$fastcgi_script_name;    
> }
> 
> I spawn my FastCGI instances using a script, but they do appear to be running:
> dummy      5854  0.0  0.8  13876  4304 ? Ss   21:23   0:00 
> /usr/bin/php5-cgi -q -b 127.0.0.1:8003
> dummy      5855  0.0  0.3  13888  1836 ? S    21:23   0:00 
> /usr/bin/php5-cgi -q -b 127.0.0.1:8003
>        
> And finally 
>  php5-cgi -v
> PHP 5.2.3-1ubuntu4 (cgi-fcgi) (built: Aug 10 2007 09:14:51)
> Copyright (c) 1997-2007 The PHP Group
> Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

Do you see "104: Connection reset by peer" sometimes or always ?

I have one report when sometime ECONNRESET was returned after upgrade
to Linux kernel 2.6.22.1. After rollback to 2.6.16.48, the error disappeared.

BTW, ECONNRESET means that RST packet was sent. On localhost it can be if
1) user process closes socket with SO_LINGER timeout 0,
2) kernel initiative.

As I understand PHP does not use SO_LINGER at all.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list