diff options
Diffstat (limited to 'build.sh')
| -rwxr-xr-x | build.sh | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..a1a1f17 --- /dev/null +++ b/build.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +INSTALL_DIR="/tmp/nginx-build" +NGX_VERSION=1.22.1 + +if [ -d "$INSTALL_DIR" ]; then + read -p "Install directory already exists. Do you want to delete it? $INSTALL_DIR [y/N] " delete + if [[ "y" == $delete ]]; then + echo rm -rf "$INSTALL_DIR" + rm -rf "$INSTALL_DIR" + fi +fi + +if [ ! -d "$INSTALL_DIR" ]; then + echo "mkdir -p $INSTALL_DIR" + mkdir -p "$INSTALL_DIR" +fi + +if [ ! -d "$INSTALL_DIR/nginx-module-vts" ]; then + git clone https://github.com/vozlt/nginx-module-vts "$INSTALL_DIR/nginx-module-vts" +fi + +if [ ! -d "$INSTALL_DIR/echo-nginx-module" ]; then + git clone https://github.com/openresty/echo-nginx-module "$INSTALL_DIR/echo-nginx-module" +fi + + +bash <(curl -f -L -sS https://ngxpagespeed.com/install) \ + --nginx-version latest \ + -b "$INSTALL_DIR" \ + -n $NGX_VERSION \ + -y \ + -a "--with-cc-opt='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2' \ + --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro' \ + --lock-path=/var/lock/nginx.lock \ + --http-client-body-temp-path=/var/lib/nginx/body \ + --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \ + --http-proxy-temp-path=/var/lib/nginx/proxy \ + --http-scgi-temp-path=/var/lib/nginx/scgi \ + --http-uwsgi-temp-path=/var/lib/nginx/uwsgi \ + --prefix=/etc/nginx \ + --sbin-path=/usr/sbin \ + --conf-path=/etc/nginx/nginx.conf \ + --pid-path=/var/run/nginx.pid \ + --error-log-path=/var/log/nginx/error.log \ + --http-log-path=/var/log/nginx/access.log \ + --user=www-data \ + --group=www-data \ + --with-pcre-jit \ + --with-http_ssl_module \ + --with-http_stub_status_module \ + --with-http_realip_module \ + --with-http_auth_request_module \ + --with-http_gzip_static_module \ + --with-http_mp4_module \ + --with-http_flv_module \ + --with-http_secure_link_module \ + --with-http_sub_module \ + --with-http_addition_module \ + --with-google_perftools_module \ + --with-http_gunzip_module \ + --with-http_random_index_module \ + --with-http_geoip_module \ + --with-http_v2_module \ + --add-module=\"$INSTALL_DIR/nginx-module-vts\" \ + --add-module=\"$INSTALL_DIR/echo-nginx-module\"" |
