41 lines
2.1 KiB
Bash
41 lines
2.1 KiB
Bash
#!/bin/bash
|
|
Cpunum=`cat /proc/cpuinfo |grep 'processor'|wc -l`;
|
|
nginx_configure='--prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_gzip_static_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --without-http_uwsgi_module --without-http_scgi_module --with-ipv6';
|
|
[ -f /usr/local/nginx/sbin/nginx ] && 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 'with-http_stub_status_module' > /dev/null; then
|
|
new_nginx_configure="${new_nginx_configure} --with-http_stub_status_module";
|
|
fi;
|
|
if ! echo "$new_nginx_configure" | grep 'with-stream' > /dev/null; then
|
|
new_nginx_configure="${new_nginx_configure} --with-stream";
|
|
fi;
|
|
if ! echo "$new_nginx_configure" | grep 'ngx_http_upstream_check_module' > /dev/null; then
|
|
new_nginx_configure="${new_nginx_configure} --add-module=modules/ngx_http_upstream_check_module";
|
|
fi;
|
|
|
|
nginx_version='';
|
|
[ -f /usr/local/nginx/sbin/nginx ] && 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" != "Tengine version: Tengine/2.3.2" ]; then
|
|
cd /usr/local/;
|
|
wget https://soft.huayizhiyun.com/manage/amh/nginx/tengine-2.3.2.tar.gz;
|
|
tar -zxf tengine-2.3.2.tar.gz;
|
|
cd tengine-2.3.2;
|
|
./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 tengine-2.3.2 tengine-2.3.2.tar.gz;
|
|
if grep -q -e "Tengine.*<br />" /home/wwwroot/index/web/View/index.php; then
|
|
sed -i "s|Tengine.*<br />|Tengine 2.3.2 <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 />|Tengine 2.3.2 <br />|" /home/wwwroot/index/web/View/index.php;
|
|
fi
|
|
fi;
|
|
|
|
nginx -v
|
|
echo 'AMH Tengine Update successful' |