帮助中心 >  技术知识库 >  云服务器 >  服务器教程 >  Nginx 遇到502 Bad Gateway 自动重启的脚本代码

Nginx 遇到502 Bad Gateway 自动重启的脚本代码

2018-01-22 23:20:28 3512

#!/usr/bin/php 
<!--$url = 'http://www.landui.com'; 
$cmd = '/usr/local/php/sbin/php-fpm restart'; 
for($i = 0; $i < 5; $i ++){ $exec = "curl connect-timeout 3 -I $url 2>/dev/null"; 
$res = shell_exec($exec); 
if(stripos($res, '502 Bad Gateway') !== false){ 
shell_exec($cmd); 
exit(); 
} 
} 
-->



提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: