Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 66 lines (55 sloc) 1.76 KB
#!/bin/bash -xe
# Latest versions shown on http://nginx.org/en/download.html
NGX_VERSION="1.15.8"
NGX_SRC="/tmp/nginx-${NGX_VERSION}"
# Latest versions shown on https://www.openssl.org/source/
OPENSSL_VERSION="1.1.1a"
OPENSSL_SRC="/tmp/openssl-${OPENSSL_VERSION}"
# Latest versions shown on https://ftp.pcre.org/pub/pcre/
PCRE_VERSION="8.42"
PCRE_SRC="/tmp/pcre-${PCRE_VERSION}"
# Latest versions shown on https://zlib.net
ZLIB_VERSION="1.2.11"
ZLIB_SRC="/tmp/zlib-${ZLIB_VERSION}"
[ -d "$NGX_SRC" ] || {
pushd $(dirname "$NGX_SRC");
wget "http://nginx.org/download/nginx-${NGX_VERSION}.tar.gz";
tar xfz "nginx-${NGX_VERSION}.tar.gz";
popd
}
[ -d "$OPENSSL_SRC" ] || {
pushd $(dirname "$OPENSSL_SRC");
wget "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz";
tar xfz "openssl-${OPENSSL_VERSION}.tar.gz";
popd
}
[ -d "$PCRE_SRC" ] || {
pushd $(dirname "$PCRE_SRC");
wget "http://downloads.sourceforge.net/project/pcre/pcre/${PCRE_VERSION}/pcre-${PCRE_VERSION}.tar.gz";
tar xfz "pcre-${PCRE_VERSION}.tar.gz";
popd
}
[ -d "$ZLIB_SRC" ] || {
pushd $(dirname "$ZLIB_SRC");
wget "https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz";
tar xfz "zlib-${ZLIB_VERSION}.tar.gz";
popd
}
cd $NGX_SRC
sudo ./configure --prefix=/opt/nginx \
--with-ipv6 \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-http_addition_module \
--with-http_mp4_module \
--with-cc-opt=-Wno-error \
--with-ld-opt= \
--with-openssl=$OPENSSL_SRC \
--with-pcre=$PCRE_SRC \
--with-pcre-jit
sudo make -f "$NGX_SRC/objs/Makefile" binary modules
sudo make -f "$NGX_SRC/objs/Makefile" install
sudo rm -r $NGX_SRC $OPENSSL_SRC $PCRE_SRC $ZLIB_SRC