summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile137
-rwxr-xr-xbuild.sh66
-rwxr-xr-xprerequisite.sh3
3 files changed, 74 insertions, 132 deletions
diff --git a/Makefile b/Makefile
index 0e02f57..90677e1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,137 +1,10 @@
-NGX_PAGESPEED_VERSION=1.9.32.10
-NGX_VERSION=1.8.0
-BUILD_DIR=nginx-$(NGX_VERSION)
-
-all: fetch build
-
-fetch: fetch_core fetch_dep pagespeed
-
-fetch_core:
- # Downloading source
- test -f nginx-$(NGX_VERSION).tar.gz || wget http://nginx.org/download/nginx-$(NGX_VERSION).tar.gz
- # Downloading signature
- test -f nginx-$(NGX_VERSION).tar.gz.asc || wget http://nginx.org/download/nginx-$(NGX_VERSION).tar.gz.asc
- # Getting public key
- gpg --keyserver keyserver.ubuntu.com --recv-keys A1C052F8
- # Verifying archiv
- gpg --verify nginx-$(NGX_VERSION).tar.gz.asc nginx-$(NGX_VERSION).tar.gz
- mkdir -p $(BUILD_DIR)
- tar xzf nginx-$(NGX_VERSION).tar.gz
-
-fetch_dep:
- cd $(BUILD_DIR) && git clone https://github.com/agentzh/headers-more-nginx-module.git
- cd $(BUILD_DIR) && git clone https://github.com/nbs-system/naxsi.git
- cd $(BUILD_DIR) && git clone https://github.com/FRiCKLE/ngx_cache_purge.git
- cd $(BUILD_DIR) && git clone https://github.com/simpl/ngx_devel_kit.git
- cd $(BUILD_DIR) && git clone https://github.com/agentzh/echo-nginx-module.git
- cd $(BUILD_DIR) && git clone https://github.com/chaoslawful/lua-nginx-module.git
- cd $(BUILD_DIR) && git clone https://github.com/wandenberg/nginx-push-stream-module.git
- cd $(BUILD_DIR) && git clone https://github.com/arut/nginx-rtmp-module.git
- cd $(BUILD_DIR) && git clone https://github.com/masterzen/nginx-upload-progress-module.git
- cd $(BUILD_DIR) && git clone https://github.com/gnosek/nginx-upstream-fair.git
- cd $(BUILD_DIR) && git clone https://github.com/aperezdc/ngx-fancyindex.git
- cd $(BUILD_DIR) && git clone https://github.com/tony2001/ngx_http_pinba_module.git
- cd $(BUILD_DIR) && git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module.git
- cd $(BUILD_DIR) && git clone https://github.com/pagespeed/ngx_pagespeed.git
- cd $(BUILD_DIR) && git clone https://github.com/alibaba/nginx-http-concat/
- cd $(BUILD_DIR) && git clone https://github.com/zebrafishlabs/nginx-statsd
- cd $(BUILD_DIR) && git clone https://github.com/newobj/nginx-x-rid-header
- cd $(BUILD_DIR) && git clone https://github.com/openresty/set-misc-nginx-module
- cd $(BUILD_DIR) && git clone https://github.com/openresty/redis2-nginx-module
- mkdir $(BUILD_DIR)/nginx-syslog && wget -O $(BUILD_DIR)/nginx-syslog/config https://raw.githubusercontent.com/gplessis/dotdeb-nginx/wheezy/debian/modules/nginx-syslog/config
+all: build
build:
- cd $(BUILD_DIR) && ./configure \
- --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-ipv6 \
- --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_spdy_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 \
- --add-module=headers-more-nginx-module \
- --add-module=naxsi/naxsi_src \
- --add-module=ngx_cache_purge \
- --add-module=ngx_devel_kit \
- --add-module=echo-nginx-module \
- --add-module=lua-nginx-module \
- --add-module=nginx-push-stream-module \
- --add-module=nginx-rtmp-module \
- --add-module=nginx-syslog \
- --add-module=nginx-upload-progress-module \
- --add-module=nginx-upstream-fair \
- --add-module=ngx-fancyindex \
- --add-module=ngx_http_pinba_module \
- --add-module=ngx_http_substitutions_filter_module \
- --add-module=./ngx_pagespeed \
- --add-module=./nginx-http-concat \
- --with-cc-opt=-I/usr/include/ossp \
- --with-ld-opt=-lossp-uuid \
- --add-module=./nginx-x-rid-header \
- --add-module=./set-misc-nginx-module \
- --add-module=./redis2-nginx-module \
- --add-module=./nginx-statsd $(NGX_CONFIGURE)
- cd $(BUILD_DIR)/ && \
- bash -c "make -j $$(grep -c processor /proc/cpuinfo)"
+ ./build.sh
install:
- cd $(BUILD_DIR)/ && make install
-
-clean:
- rm nginx-$(NGX_VERSION).tar.gz
- rm nginx-$(NGX_VERSION).tar.gz.asc
-
-prepare:
- @(lsb_release -a | grep Debian || ! test -z $(DEBIAN)) || (echo "You don't run Debian, do you? This section is optimized for the Debian GNU/Linux distro.\nOverwrite it with 'DEBIAN=1 make prepare'.\n" && exit 1)
- dpkg -l | grep build-essential || apt-get install -y build-essential
- dpkg -l | grep zlib1g-dev || apt-get install -y zlib1g-dev
- dpkg -l | grep -E '^libpcre3$$' || apt-get install -y libpcre3
- dpkg -l | grep -E '^libpcre3-dev$$' || apt-get install -y libpcre3-dev
- dpkg -l | grep liblua5.1-0-dev || apt-get install -y liblua5.1-0-dev
- dpkg -l | grep libossp-uuid-dev || apt-get install -y libossp-uuid-dev
- dpkg -l | grep uuid-dev || apt-get install -y uuid-dev
- dpkg -l | grep libgoogle-perftools-dev || apt-get install -y libgoogle-perftools-dev
- dpkg -l | grep libssl-dev || apt-get install -y libssl-dev
- dpkg -l | grep libgeoip-dev || apt-get install -y libgeoip-dev
+ @echo "run 'make build' instead"
-pagespeed:
- @(test -d $(BUILD_DIR)/ngx_pagespeed && cd $(BUILD_DIR)/ngx_pagespeed && \
- echo "Downloading pagespeed library." && \
- # Documentation recommends now to download from Github:
- # https://github.com/pagespeed/ngx_pagespeed/archive/release-${NGX_PAGESPEED_VERSION}-beta.zip
- wget https://dl.google.com/dl/page-speed/psol/$(NGX_PAGESPEED_VERSION).tar.gz && \
- tar -xzvf $(NGX_PAGESPEED_VERSION).tar.gz) || \
- echo "You need to run 'make fetch_dep' first to download ngx_pagespeed."
-
-help:
- @echo "This is a Makefile to automatize compiling nginx from source.\n"
- @echo "Run 'make fetch' to fetch the core and addons."
- @echo "Run 'make build' to configure and compile nginx. If you want to pass options to ./configure you can do this with 'NGX_CONFIGURE=options... make build' on the commmand line."
- @echo "'make install' will install it system wide (needs root privileges)."
- @echo "If you are on GNU/Debian, you can run 'make prepare' to install some needed libraries."
+apt:
+ ./prerequisite.sh
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\""
diff --git a/prerequisite.sh b/prerequisite.sh
new file mode 100755
index 0000000..f127de5
--- /dev/null
+++ b/prerequisite.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+apt install libssl-dev libgeoip-dev libgoogle-perftools-dev git