Update upgrade-nginx.sh
This commit is contained in:
parent
c6a5463855
commit
de8084b4f7
|
@ -1,10 +1,14 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
VERSION="1.10.0"
|
VERSION="1.10.0"
|
||||||
OLD_VERSION=$(nginx -v 2>&1|cut -d '/' -f 2)
|
|
||||||
|
|
||||||
SSL_VERSION="1.0.2g"
|
if [ ! -z "$1" ];then
|
||||||
ZLIB_VERSION="1.2.8"
|
VERSION="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Start building nginx-$VERSION ..."
|
||||||
|
|
||||||
|
OLD_VERSION=$(nginx -v 2>&1|cut -d '/' -f 2)
|
||||||
|
|
||||||
cd || exit 1
|
cd || exit 1
|
||||||
|
|
||||||
|
@ -17,28 +21,41 @@ mkdir nginx
|
||||||
cd nginx || exit 1
|
cd nginx || exit 1
|
||||||
|
|
||||||
# Download and extract nginx
|
# Download and extract nginx
|
||||||
wget http://nginx.org/download/nginx-$VERSION.tar.gz
|
wget "http://nginx.org/download/nginx-$VERSION.tar.gz"
|
||||||
tar xf nginx-$VERSION.tar.gz
|
tar xf "nginx-$VERSION.tar.gz"
|
||||||
|
|
||||||
# Download and extract OpenSSL
|
|
||||||
wget https://www.openssl.org/source/openssl-$SSL_VERSION.tar.gz
|
|
||||||
tar xf openssl-$SSL_VERSION.tar.gz
|
|
||||||
|
|
||||||
# Download and extract gzip
|
|
||||||
wget http://zlib.net/zlib-$ZLIB_VERSION.tar.gz
|
|
||||||
tar xf zlib-$ZLIB_VERSION.tar.gz
|
|
||||||
|
|
||||||
# Delete downloads
|
# Delete downloads
|
||||||
rm -- *.tar.gz
|
rm -- *.tar.gz
|
||||||
|
|
||||||
|
# Download ngx_http_auth_pam_module
|
||||||
|
git clone https://github.com/stogh/ngx_http_auth_pam_module \
|
||||||
|
"nginx-$VERSION/modules/nginx-auth-pam"
|
||||||
|
|
||||||
|
# Download nginx-dav-ext-module
|
||||||
|
git clone https://github.com/arut/nginx-dav-ext-module \
|
||||||
|
"nginx-$VERSION/modules/nginx-dav-ext-module"
|
||||||
|
|
||||||
|
# Download echo-nginx-module
|
||||||
|
git clone https://github.com/openresty/echo-nginx-module \
|
||||||
|
"nginx-$VERSION/modules/nginx-echo"
|
||||||
|
|
||||||
|
# Download nginx-upstream-fair
|
||||||
|
git clone https://github.com/gnosek/nginx-upstream-fair \
|
||||||
|
"nginx-$VERSION/modules/nginx-upstream-fair"
|
||||||
|
|
||||||
# Download ngx_http_substitutions_filter_module
|
# Download ngx_http_substitutions_filter_module
|
||||||
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module
|
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module \
|
||||||
|
"nginx-$VERSION/modules/ngx_http_substitutions_filter_module"
|
||||||
|
|
||||||
|
# Download nginx-module-vts
|
||||||
|
git clone https://github.com/vozlt/nginx-module-vts \
|
||||||
|
"nginx-$VERSION/modules/nginx-module-vts"
|
||||||
|
|
||||||
cd "nginx-$VERSION" || exit 1
|
cd "nginx-$VERSION" || exit 1
|
||||||
|
|
||||||
./configure \
|
./configure \
|
||||||
--with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' \
|
--with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' \
|
||||||
--with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' \
|
--with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' \
|
||||||
--sbin-path=/usr/sbin/nginx \
|
--sbin-path=/usr/sbin/nginx \
|
||||||
--prefix=/usr/share/nginx \
|
--prefix=/usr/share/nginx \
|
||||||
--conf-path=/etc/nginx/nginx.conf \
|
--conf-path=/etc/nginx/nginx.conf \
|
||||||
|
@ -57,23 +74,34 @@ cd "nginx-$VERSION" || exit 1
|
||||||
--with-http_ssl_module \
|
--with-http_ssl_module \
|
||||||
--with-http_stub_status_module \
|
--with-http_stub_status_module \
|
||||||
--with-http_realip_module \
|
--with-http_realip_module \
|
||||||
|
--with-http_auth_request_module \
|
||||||
--with-http_addition_module \
|
--with-http_addition_module \
|
||||||
--with-http_dav_module \
|
--with-http_dav_module \
|
||||||
--with-http_geoip_module \
|
--with-http_geoip_module \
|
||||||
|
--with-http_gunzip_module \
|
||||||
--with-http_gzip_static_module \
|
--with-http_gzip_static_module \
|
||||||
--with-http_image_filter_module \
|
--with-http_image_filter_module \
|
||||||
--with-http_v2_module \
|
--with-http_v2_module \
|
||||||
--with-http_sub_module \
|
--with-http_sub_module \
|
||||||
--with-http_xslt_module \
|
--with-http_xslt_module \
|
||||||
|
--with-stream \
|
||||||
|
--with-stream_ssl_module \
|
||||||
--with-mail \
|
--with-mail \
|
||||||
--with-mail_ssl_module \
|
--with-mail_ssl_module \
|
||||||
--with-http_sub_module \
|
--with-threads \
|
||||||
--with-zlib=../zlib-$ZLIB_VERSION \
|
--add-module=modules/nginx-auth-pam \
|
||||||
--with-openssl=../openssl-$SSL_VERSION \
|
--add-module=modules/nginx-dav-ext-module \
|
||||||
--add-module=../ngx_http_substitutions_filter_module
|
--add-module=modules/nginx-echo \
|
||||||
|
--add-module=modules/nginx-upstream-fair \
|
||||||
|
--add-module=modules/ngx_http_substitutions_filter_module \
|
||||||
|
--add-module=modules/nginx-module-vts
|
||||||
|
|
||||||
make
|
make
|
||||||
|
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Stop service ..."
|
echo "Stop service ..."
|
||||||
service nginx stop
|
service nginx stop
|
||||||
cd /etc || exit 1
|
cd /etc || exit 1
|
||||||
|
|
Loading…
Reference in New Issue