准备文件: A T: q9 U' V, I6 e7 y
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz* w# o( I! [3 V/ F
tar xvzf openssl-1.1.0f.tar.gz2 V& M$ Z- i [7 q% h" N B7 b
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz. T$ [% I: h$ A! J5 h
tar xvzf pcre-8.41.tar.gz
3 Q% ?* q. b4 ^
& m: v! Y) | zwget http://nginx.org/download/nginx-1.13.6.tar.gz
4 X% i& A0 N! a% P- i" i0 }0 Ltart xvzf nginx-1.13.6.tar.gz
- @' @ W! |+ f7 X T% I6 e0 h7 c0 h% @2 ^# N T' B
wget https://github.com/openresty/sregex/archive/master.zip
, F( B5 Q/ g- F1 }5 C+ S/ rmv master.zip replace-filter-nginx-module-master.zip0 G0 A/ J' H; r3 H2 [2 g
unzip replace-filter-nginx-module-master.zip8 G9 G* G, v) A6 H
" v/ L; N8 B0 t9 ^" C安装sregex
8 h* U; |) g" f4 x) c[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]/ P! s m+ T2 K6 p2 |$ v k; E e; r
wget https://github.com/openresty/sregex/archive/master.zip
" k1 `7 v* c' `mv master.zip sregex.zip! c% g) k1 f+ v
unzip sregex.zip
( k3 J% k# X4 m% ocd sregex; e& c7 e' p) R
make && make installln -s /usr/lib/libsregex.so.0 /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
% o% y- F/ k8 j2 tldconfig1 `3 D/ F' Q2 H* B+ Z4 s
/ h; G7 @ |4 Z: S3 O, S安装modsecurity
9 y7 i; O$ b% B/ |& o6 z) T3 e2 f7 B; d『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel pcre pcre-devel libxml2 libxml2-devel)』
2 ?$ b- }3 ?- m% @& r1 kgit clone https://github.com/SpiderLabs/ModSecurity.git mod_security, ~7 |4 b2 l; v5 E
cd mod_security
: I+ { k& b1 L0 T./autogen.sh $ T$ Y2 w, `. W+ r
./configure --enable-standalone-module
/ Z. M7 ^" N5 z6 }make
- m) r$ ]4 a* r7 t+ M7 m
! f9 {" x' q; @- c7 J5 u+ k1 o; `; P
4 W. [" K6 T7 Q h, ?安装nginx# x' b4 j% f) F2 L+ p" Z! ]/ K `
cd nginx-1.13.6" J& q% A0 Q) Y; F
7 ^ w8 i) Z! Z, l5 k[Bash shell] 纯文本查看 复制代码 ./configure \
--user=www \
--group=www \
--prefix=/www/webserver/nginx-1.13.6 \
--sbin-path=/www/webserver/nginx-1.13.6/sbin/nginx \
--pid-path=/www/webserver/nginx-1.13.6/logs/nginx.pid \
--conf-path=/www/webserver/nginx-1.13.6/conf/nginx.conf \
--error-log-path=/www/webserver/nginx-1.13.6/logs/error.log \
--http-log-path=/www/webserver/nginx-1.13.6/logs/access.log \
--http-client-body-temp-path=/www/webserver/nginx-1.13.6/temp/client \
--http-proxy-temp-path=/www/webserver/nginx-1.13.6/temp/proxy \
--http-fastcgi-temp-path=/www/webserver/nginx-1.13.6/temp/fcgi \
--http-scgi-temp-path=/www/webserver/nginx-1.13.6/temp/scgi \
--http-uwsgi-temp-path=/www/webserver/nginx-1.13.6/temp/uwsgi \
--with-http_flv_module \
--with-http_stub_status_module \
--with-http_realip_module \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_gzip_static_module \
--with-pcre=/root/pcre-8.41 \
--with-http_sub_module \
--add-module=/root/replace-filter-nginx-module-master \
--add-module=/root/mod_security/nginx/modsecurity \
--with-openssl=/root/openssl-1.1.0f
5 ]% S9 I3 B4 ~( [4 o: dmake
- S8 @. q! A1 [1 x( H3 N9 Imake install6 R2 i6 d I6 h: \
/ {* h# W. s5 S( G
注:--with-ipv6 已经被移除默认支持ipv6, --with-http_spdy 已经被移除合并到--with-http_v2_module
4 @( L9 C, F& e) e5 F7 ^7 L7 P4 ~. r
: } C% ~* i4 o9 }' |" f
0 }" M- S: r+ o* g; S
' Y$ U+ ~1 `& @+ q7 Y0 r9 n
. k/ c2 F, J; @2 [2 l8 e/ m7 l9 ^- \. R' ^5 P
- N* A# L( y) p. ^( Y3 r$ _- i
% h$ v' }* z: D& A+ e. A
" j3 T q% k. y2 ] |