Php-fpm often provides 502 solutions. Php-fpm often appears 502 solution more Please support: www.Bkjia.com nginx often 502 recently, the best solution to 502 is to restart php-fpm. Manual restart is still a hassle. php-fpm often offers 502 solutions.
For more information, see www.Bkjia.com.
Nginx is often 502 recently. The best solution to 502 is to restart php-fpm.
Manual restart is still troublesome. The best thing is to throw it to 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 is not running service php-fpm startfi
The local virtual machine tested it. it was feasible to throw it to the server. it was found that no php-fpm process was found at 502, but php-fpm was dead.
Therefore, another solution is adopted:
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, the content here will be executed, add or modify killall-9 php-cgiservice php-fpm restartfi
In this case, you can manually add it to the crontab if you need it automatically.
Chmod 755 restart-php-fpm.sh
Run crontab-e
Set the restart-php-fpm.sh to run automatically every minute (time can be adjusted as needed)
*/1 ***/home/restart-php-fpm.sh
Check whether the setting is successful or not.
Crontab-l
Or you can write a shell endless loop and execute it every other time.
For more information, see www.Bkjia.com. nginx is often 502 recently. The best solution to this problem is to restart php-fpm. Manual restart is still troublesome ,...