PHP-FPM often appears 502 solutions
Please support: www.Bkjia.com
Recently nginx often 502, solve 502 the best way is to restart PHP-FPM.
Manual to restart or more troublesome things, the best is to throw into the shell.
Vim restart-php-fpm.sh
#!/bin/shservice= ' php-fpm ' #if PS Ax | Grep-v grep | grep $SERVICE >/dev/nullif NETSTAT-ANP | grep 9000 >/dev/nullthen echo $SERVICE SERVICE running, everything is Fineelse echo $SERVICE was not running
service PHP-FPM Startfi
Local virtual machine test, feasible, throw to the server, the results found that 502 did not php-fpm no process, but PHP-FPM zombie.
So I went. Another option:
Vim restart-php-fpm.sh
#!/bin/bashmy_url=http://www.webyang.netresult= ' Curl-i $MY _url | grep http/1.1 502\ ' If [-N $RESULT]; then# If 502 will execute the content here, add or change killall-9 php-cgiservice php-fpm Restartfi
This way, or manual, if you need to automatically add yourself to the crontab.
chmod 755 restart-php-fpm.sh
Run CRONTAB-E
Set restart-php-fpm.sh to be executed automatically every minute (time can be adjusted according to your own requirements)
*/1 * * * */home/restart-php-fpm.sh
To see if a setting succeeds or fails
Crontab-l
or write a shell dead loop, and execute it every other time.
http://www.bkjia.com/PHPjc/953324.html www.bkjia.com true http://www.bkjia.com/PHPjc/953324.html techarticle PHP-FPM often appears 502 solutions more support: Www.Bkjia.com recently nginx often 502, solve 502 the best way is to restart PHP-FPM. Manual to restart or more troublesome things, ...