准备文件:1 ^8 p W3 S3 i. ^. C, f) ]
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz. k, G" i4 H& W
tar xvzf openssl-1.1.0f.tar.gz
, H- v& }7 g9 M" T4 |wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz4 P8 a/ U' [8 q) O- m/ @' y
tar xvzf pcre-8.41.tar.gz
9 x; v. {( o* w/ c& W; [1 I: j6 h- O1 U# h" @& f4 a) b, Q4 s! c
wget http://nginx.org/download/nginx-1.13.6.tar.gz J. ]+ p; W+ x
tart xvzf nginx-1.13.6.tar.gz: k5 b" A% _3 c- M, @9 C% P' p
) Q" E3 v6 o5 p, Pwget https://github.com/openresty/sregex/archive/master.zip& M# v! C9 B7 o I' U5 C
mv master.zip replace-filter-nginx-module-master.zip
# V4 \9 U$ \( `- |) W% _unzip replace-filter-nginx-module-master.zip
9 Z0 W7 g5 W* ?" L; E' V: R
! Q6 f" a2 }4 N' Y I0 q. p& B: @安装sregex ?) ~' G, N) {
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]. }& e6 \& Y! h9 P( L5 O. Y
wget https://github.com/openresty/sregex/archive/master.zip; F1 ]4 v2 t' c' h4 [
mv master.zip sregex.zip: U2 F2 Y+ S6 E/ D
unzip sregex.zip
7 \* Z8 k& `! e. f. H2 |& Pcd sregex! j/ R0 C6 U' ~/ R0 I9 z
make && make installln -s /usr/lib/libsregex.so.0 /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
* `: \7 C: k" f* B6 `ldconfig5 G2 {4 v# Q$ L- k: j
1 h" A+ A3 Q2 u8 R! T. ?) O
安装modsecurity5 P: [4 J9 }! d4 x) ^
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel pcre pcre-devel libxml2 libxml2-devel)』- h6 p0 e( ]7 i
git clone https://github.com/SpiderLabs/ModSecurity.git mod_security! m1 B5 A7 R U9 o; O% M
cd mod_security1 g9 ]6 O! o) c% Q8 a7 I
./autogen.sh M' Z. Y0 @1 } n
./configure --enable-standalone-module. G, K& K. a+ N. n) Y/ g* [
make
$ m) W0 @: o& P6 W( `0 D
0 }9 d8 W0 M- O9 f- S. ]7 E. F
# {1 F, u J/ \6 {2 H安装nginx
/ K' x8 T( Z7 K2 ]" M; {- {cd nginx-1.13.6
/ l) B0 C6 b3 ~& o8 U4 V2 t: ^! i$ z2 L8 d
[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
% N8 B. L* s. q6 w2 mmake: t/ v3 M) v2 D! C3 m( I
make install
_1 k( x e0 f/ p) I8 n1 r: \5 p
注:--with-ipv6 已经被移除默认支持ipv6, --with-http_spdy 已经被移除合并到--with-http_v2_module$ Z2 A! j$ A2 o8 m" k
- h/ ^- b) q+ j4 M6 ~' A9 y1 A: G# \5 E9 [; |! M; P
( X& P/ [& ^' G. ]! }
, R7 L% j5 u& Y" s
' S% j$ T8 @7 q. c+ }' s% a& Z+ r% w/ {. I4 [6 S: C, b0 B, K- y5 D
9 `, y9 n+ `+ e8 u* O: r: O$ r
, Z0 ] ^6 z9 @5 H( m" R
$ J# ?8 o8 A/ T1 w" A
|