准备文件: e4 S. s4 \$ X0 X
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
+ h" v( m" a1 ~# r2 H2 v5 H. gtar xvzf openssl-1.1.0f.tar.gz" m. T" b u7 }- h
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
* [, a" R5 {5 L$ H3 R) Atar xvzf pcre-8.41.tar.gz7 [; E5 t: y+ o
$ y* N" _6 N8 C/ W0 g: p* Xwget http://nginx.org/download/nginx-1.13.6.tar.gz) Y* V3 M3 X; V( {: M( x7 V
tart xvzf nginx-1.13.6.tar.gz* v ~$ P7 p5 }8 p* y, Z
( M) K# X( h, t8 `8 ewget https://github.com/openresty/sregex/archive/master.zip+ d& N+ e5 S, U" x0 {
mv master.zip replace-filter-nginx-module-master.zip
* i9 ~. a- @! ?! u: Tunzip replace-filter-nginx-module-master.zip
3 J& M6 l! i ?* M7 |/ F% W
" g; w7 G6 N8 Q7 O' B安装sregex( H* n3 I2 n* ]6 b3 H; C5 I
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
8 W; M5 r( P& e, v' D; G, F- gwget https://github.com/openresty/sregex/archive/master.zip
) f E# x' [4 J5 w: N3 s: S: Cmv master.zip sregex.zip/ c* j5 u2 l! }. ^
unzip sregex.zip1 ~+ ?& L" N5 N) j# n
cd sregex: k2 c t' t8 K
make && make installln -s /usr/lib/libsregex.so.0 /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
: t/ ]* h6 _$ ~- k J. Gldconfig' t+ p2 b$ Y: L- d
! a% z( j, I( @) C9 ^4 y安装modsecurity2 ^: g5 q! y' q
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel pcre pcre-devel libxml2 libxml2-devel)』+ l: W6 k2 y6 Y" q* z" Y9 Q
git clone https://github.com/SpiderLabs/ModSecurity.git mod_security
; s$ r+ L/ f# x( Vcd mod_security
9 \$ o5 G) u/ K8 m4 _% B./autogen.sh * k; n2 E8 l- E$ u8 ~
./configure --enable-standalone-module6 Y+ F0 U; l: h& X3 y% [
make
1 f! f E; L) N
8 Q. S( j) }; h4 B F1 m
0 f6 P6 D" a) E2 a3 W安装nginx
" T# t2 E y, d! a$ @( N2 xcd nginx-1.13.6
3 L: g5 _6 r, M1 `& ]" U! `4 e- g7 z( w
[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 4 |4 D- Q: F- Z1 @& Z2 y* ^
make; q' ?/ F$ t5 n
make install# ?/ @+ |/ i% j9 z! |
0 g" h, j3 J5 q
注:--with-ipv6 已经被移除默认支持ipv6, --with-http_spdy 已经被移除合并到--with-http_v2_module
; g" V- v5 `6 ~4 F2 ~+ t, g7 \# X' x: i' n- V8 I! h; U* R
# a) I9 y, c5 U! R5 W
0 w$ n5 M# i7 j$ L9 J
1 b' E4 A k) q0 r2 I6 u* D' k' Y0 g8 B4 a
7 t X) o9 U* u; l* d7 K9 c5 O7 f
& G, d; m" [+ q5 B) `+ F. {
. e6 m1 X! s( }2 e0 v1 b3 C' f7 l/ O6 ?9 ?" @: l# m
|