summaryrefslogtreecommitdiff
path: root/build.sh
blob: a1a1f17c4cd3aac98d6da1107a7f689037bc0b84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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\""