Nginx WAF

Nginx 默认编译配置参数

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
--with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-5J5hor/nginx-1.18.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' \
--prefix=/usr/share/nginx \
--conf-path=/etc/nginx/nginx.conf \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--lock-path=/var/lock/nginx.lock \
--pid-path=/run/nginx.pid \
--modules-path=/usr/lib/nginx/modules \
--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 \
--with-debug \
--with-compat \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_v2_module \
--with-http_dav_module \
--with-http_slice_module \
--with-threads \
--with-http_addition_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_image_filter_module=dynamic \
--with-http_sub_module \
--with-http_xslt_module=dynamic \
--with-stream=dynamic \
--with-stream_ssl_module \
--with-mail=dynamic \
--with-mail_ssl_module \

Nginx 默认编译配置参数 - 支持

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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
DEFAULT_BUILD_SRC_DIR=/opt/nginx-src

NGINX_GZ=${DEFAULT_BUILD_SRC_DIR}/nginx-1.18.0.tar.gz
NGINX_SRC=${DEFAULT_BUILD_SRC_DIR}/nginx-1.18.0
NGINX_GZ_SHA256=4C373E7AB5BF91D34A4F11A0C9496561061BA5EEE6020DB272A17A7228D35F99

NGINX_GZ_DOWN_LOAD=0
NGINX_GZ_OK=0

if [ ! -d "${DEFAULT_BUILD_SRC_DIR}" ]; then
mkdir "${DEFAULT_BUILD_SRC_DIR}"
fi

if [ -f "${NGINX_GZ}" ]; then
sha256sum_results=$(sha256sum $NGINX_GZ)
sha256sum_results=${sha256sum_results^^}
if [[ $sha256sum_results =~ "${NGINX_GZ_SHA256}" ]]; then
NGINX_GZ_DOWN_LOAD=0
NGINX_GZ_OK=1
else
NGINX_GZ_DOWN_LOAD=1
fi
unset sha256sum_results
else
NGINX_GZ_DOWN_LOAD=1
fi


if [ $NGINX_GZ_DOWN_LOAD -eq 1 ]; then
# Download Nginx 1.18.0
wget -O $NGINX_GZ http://nginx.org/download/nginx-1.18.0.tar.gz
if [ -f "${NGINX_GZ}" ]; then
sha256sum_results=$(sha256sum $NGINX_GZ)
sha256sum_results=${sha256sum_results^^}
if [[ $sha256sum_results =~ "${NGINX_GZ_SHA256}" ]]; then
NGINX_GZ_OK=1
fi
unset sha256sum_results
fi
fi
unset NGINX_GZ_DOWN_LOAD

if [ -d "${NGINX_SRC}" ]; then
rm -rf "${NGINX_SRC}"
fi

echo "FILE OK:${NGINX_GZ_OK}"
if [ $NGINX_GZ_OK -eq 1 ]; then
# 安装依赖
apt-get install openssl libssl-dev
apt-get install libpcre3 libpcre3-dev #>/dev/null
tar xvf $NGINX_GZ -C $DEFAULT_BUILD_SRC_DIR >/dev/null 2>&1
# 解压成功
cd $NGINX_SRC >/dev/null 2>&1
# echo $(pwd)
./configure --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-5J5hor/nginx-1.18.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' \
--prefix=/usr/share/nginx \
--conf-path=/etc/nginx/nginx.conf \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--lock-path=/var/lock/nginx.lock \
--pid-path=/run/nginx.pid \
--modules-path=/usr/lib/nginx/modules \
--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 \
# --with-debug \
# --with-compat \
--with-pcre-jit \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_v2_module \
--with-http_dav_module \
--with-http_slice_module \
--with-threads \
--with-http_addition_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_image_filter_module=dynamic \
--with-http_sub_module \
--with-http_xslt_module=dynamic \
--with-stream=dynamic \
--with-stream_ssl_module \
--with-mail=dynamic \
--with-mail_ssl_module
fi