Nginx giving 502 Bad Gateway in random intervals

I am getting a 502 Bad Gateway on my server after any random intervals.

If i run the following code the server starts working again:

/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f
/usr/bin/php5-cgi -P /var/run/fastcgi-php.pid

I have tried every possible way available on the internet.

Can anyone help I am kinda newbie with server configs and stuff…!!

Thanx

Posted at Nginx Forum:

Increase the pm.max_children, pm.start_servers, pm.min_spare_servers and
pm.max_spare_servers in the www.conf
this should help

Posted at Nginx Forum:

Hi,

Thanks for the help. It seems I don’t have a www.conf in my nginx
folder.
This might sound naive but I am not able to find www.conf file.

Upon search, I got to know that it should be in opt folder. But there is
nothing in it.

I have a nginx running on fcgi and Debian Squeeze.

Posted at Nginx Forum:

this is something that i do whenever this happens. and error goes away.

but it happens again. about 3-4 times a day.

is there a way to solve this permanently?

Posted at Nginx Forum:

Oh sorry, that was my fault. I thought you are using php-fpm.
If you are using fcgi than you could use
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f
/usr/bin/php5-cgi -P /var/run/fastcgi-php.pid -C 6
The number after -C is the amount of children.

Posted at Nginx Forum:

Use this command with the “-C 6” and than you should be happy

Posted at Nginx Forum:

I would suggest using php-fpm, its very easy to setup, in fact its
integrated to recent releases of PHP (5.4++)

I am using php 5.3.3 and trying to install php-fpm and on research i
came to
know that php-fpm come bundled wirh 5.3.3 but still not able to find it.

http://trainingjunction.in/phpinfo.php

where am i going wrong?

Posted at Nginx Forum:

I am using php 5.3.3 but still not able to find php-fpm in it!!

http://trainingjunction.in/phpinfo.php

where am i going wrong?

Posted at Nginx Forum:

Add those lines to yout /etc/apt/sources.list

#php
deb http://packages.dotdeb.org squeeze all
deb-src http://packages.dotdeb.org squeeze all

than run
apt-get update
apt-get upgrade
apt-get install php5-fpm

Posted at Nginx Forum:

darshan.choudhary Wrote:

Did everything you mentioned above but still it is showing after I
run/etc/init.d/php-fpm start

-bash: /etc/init.d/php-fpm: No such file or directory

I somehow managed to install fpm and now it is not starting.

service php5-fpm restart gives me this error:
Restarting PHP5 FastCGI Process Manager: php5-fpm failed!

When i see the logs this is latest error that shows up:
unable to bind listening socket for address ‘127.0.0.1:9000’: Address
already in use (98)

Can you please point me anything that is going wrong…!!

Posted at Nginx Forum:

Did everything you mentioned above but still it is showing after I
run/etc/init.d/php-fpm start

-bash: /etc/init.d/php-fpm: No such file or directory

Posted at Nginx Forum:


nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx