准备文件:4 d1 l2 {3 H. t1 O
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
( P- {/ J. ]; V: Star xvzf openssl-1.1.0f.tar.gz6 v( t6 v* j. x* P- S' q/ w
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz# @+ C6 j9 {0 o) c! g! j, J* G$ {
tar xvzf pcre-8.41.tar.gz! B0 Y# C5 W& M) t! O) C/ |
7 t' R8 l" h# nwget http://nginx.org/download/nginx-1.13.6.tar.gz
7 T, ^4 K9 S0 a& J- A- h# wtart xvzf nginx-1.13.6.tar.gz
+ H* f3 q8 B( o' y3 j. d( o# s! W# B$ H2 J7 d
wget https://github.com/openresty/sregex/archive/master.zip9 K/ i- |# P2 _9 J! F8 a
mv master.zip replace-filter-nginx-module-master.zip
- f" H* C; S& x3 D! ^unzip replace-filter-nginx-module-master.zip9 r5 J1 y) R1 a: t( p5 {8 p5 Q/ s
7 B3 U2 ^' V K
安装sregex; A/ Y$ W' x$ V; t c9 B) g& J" n
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
3 k0 x2 s: H& U# u; ]* k* owget https://github.com/openresty/sregex/archive/master.zip" K" }, r0 }. ?/ z& ?; }$ F
mv master.zip sregex.zip
& i+ ?3 G' }% N* m+ tunzip sregex.zip& i, p4 }& K* W2 `' O' p3 B, u
cd sregex
, W* }( Z8 a: _3 @4 j' J* Rmake && make installln -s /usr/lib/libsregex.so.0 /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整) g4 _' e c0 j: C F9 O
ldconfig
) v4 b a2 B- M% Y+ P$ M! ~! S
* F3 T# e4 Z5 K' f3 s r安装modsecurity
# k! X9 t( e; @! ]( ~+ o『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel pcre pcre-devel libxml2 libxml2-devel)』# a, f, e: f4 ~$ f$ h7 |& z
git clone https://github.com/SpiderLabs/ModSecurity.git mod_security
/ [0 F4 {! [2 h# C! f: B3 E* ucd mod_security
t$ W. q6 t) P, R6 b5 z3 r./autogen.sh
, N$ z% F) M+ r+ V./configure --enable-standalone-module6 S2 r' O" ?5 U2 q) A, A) I
make
8 z6 {$ d3 K2 e3 j
$ ^& U6 S; c. ^* H1 i, ~8 m, x% ^% x+ e4 K3 W( e1 b1 K
安装nginx
- Z& |7 l( L' ?* N( v5 Mcd nginx-1.13.6
; M- V6 s2 T; W& q! E
6 O" G& g5 g, {. C[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 , |# T/ [3 { [* K
make2 z7 W6 S- X. V6 ~/ P
make install3 S1 Q9 `- x* r& p& J
' T( H6 F% h. Z4 t/ g# m
注:--with-ipv6 已经被移除默认支持ipv6, --with-http_spdy 已经被移除合并到--with-http_v2_module- i; k' u! g( Q/ F+ }
. d! D" s$ ]) N8 r# Z5 L7 n7 {( \" e. z
' l8 l/ d* ^2 Q/ B/ l0 x; T! N; W
6 E8 g' G" v5 y& g, f
: t" O! c5 X9 a9 k+ f" ~+ s9 P- X6 i6 f: S7 m
. n( q' j( }6 R) E% g0 o
$ P# d2 [ n4 N# V4 e
# I- p; U$ ~0 K5 P3 T |