33 lines
1.5 KiB
Bash
33 lines
1.5 KiB
Bash
#!/bin/bash
|
|
Cpunum=`cat /proc/cpuinfo |grep 'processor'|wc -l`;
|
|
nginx_configure=`/usr/local/nginx/sbin/nginx -V 2> /tmp/nginx_configure && cat /tmp/nginx_configure | grep 'configure arguments' | cut -d: -f2 && rm -f /tmp/nginx_configure`;
|
|
new_nginx_configure=$nginx_configure;
|
|
if echo "$new_nginx_configure" | grep 'ngx_http_upstream_check_module' > /dev/null; then
|
|
new_nginx_configure=`echo $new_nginx_configure | sed "s| --add-module=modules/ngx_http_upstream_check_module||"`;
|
|
fi;
|
|
|
|
nginx_version=`/usr/local/nginx/sbin/nginx -v 2> /tmp/nginx_version && cat /tmp/nginx_version && rm -f /tmp/nginx_version`;
|
|
echo $nginx_version;
|
|
|
|
if [ "$nginx_version" != "nginx version: nginx/1.14.0" ]; then
|
|
cd /usr/local/;
|
|
wget https://soft.huayizhiyun.com/manage/amh/nginx/nginx-1.14.0.tar.gz;
|
|
tar -zxf nginx-1.14.0.tar.gz;
|
|
cd nginx-1.14.0;
|
|
./configure $new_nginx_configure;
|
|
make -j $Cpunum;
|
|
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx-old;
|
|
\cp -a ./objs/nginx /usr/local/nginx/sbin/;
|
|
kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`;
|
|
cd /usr/local/;
|
|
rm -rf nginx-1.14.0 nginx-1.14.0.tar.gz;
|
|
if grep -q -e "Tengine.*<br />" /home/wwwroot/index/web/View/index.php; then
|
|
sed -i "s|Nginx.*<br />|Nginx 1.14.0 <br />|" /home/wwwroot/index/web/View/index.php;
|
|
fi
|
|
if grep -q -e "Nginx.*<br />" /home/wwwroot/index/web/View/index.php; then
|
|
sed -i "s|Nginx.*<br />|Nginx 1.14.0 <br />|" /home/wwwroot/index/web/View/index.php;
|
|
fi
|
|
fi;
|
|
|
|
nginx -v
|
|
echo 'AMH Nginx Update Done' |