CentOS 6.x升级系统和PHP的curl,利用curl和cron自动重启https网站的php-fpm
curl -I https://www.zhangfangzhou.cn/
curl: (35) SSL connect error #需要升级curl
wget https://curl.haxx.se/download/curl-7.50.0.tar.gz
tar -zxvf curl-7.50.0.tar.gz
cd curl-7.50.0
./configure --prefix=/usr/local/curl
make
make install
cp /usr/local/curl/bin/curl /usr/bin/curl #在源码的文件夹里面也有/root/curl-7.50.0/src/curl
curl --version
curl 7.50.0 (x86_64-pc-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
php源码编译
--with-curl=/usr/local/curl/
502 Bad Gateway 自动重启脚本
#!/bin/bash
website="https://www.zhangfangzhou.cn/ https://www.zhangfangzhou.com"
if
/usr/bin/curl -I $website|grep "HTTP/1.1 502"
then
/bin/date -R >>/root/502.log
/etc/rc.d/init.d/nginx restart
fi
给予可执行权限:
chmod +x /root/502.sh
通过 crontab 设置周期运行:
crontab -u root -e
* * * * * /root/502.sh >/dev/null 2>&1