准备文件:! G& ^& m c( E' u4 r7 J1 z# T
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz. @- G3 |* i* n7 p' |* ?! D
tar xvzf openssl-1.1.0f.tar.gz' Q, @- F/ Z- c& Y' J) K
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
9 E/ |7 o8 N7 ~; @& [# f0 btar xvzf pcre-8.41.tar.gz4 U7 L9 E! `9 h+ C( O/ |2 i% o' k8 r" F7 J
8 c: s7 M/ ]4 g2 Ywget http://nginx.org/download/nginx-1.13.6.tar.gz- |' e0 \( v5 a7 v7 d& u
tart xvzf nginx-1.13.6.tar.gz
: v. s) Z' h y/ _5 P$ P7 k6 k7 F3 `4 E& s9 F
wget https://github.com/openresty/sregex/archive/master.zip
- E) |# P N% v- p7 O( Jmv master.zip replace-filter-nginx-module-master.zip
% @+ i6 |* U7 q7 K' \/ punzip replace-filter-nginx-module-master.zip. }7 ~9 o$ a) y3 m! d1 F
# C8 j1 ~7 W) | O, c
安装sregex
' Q/ E7 e" P! [2 d) T[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]3 D) R; b0 a. Z A" u g1 V
wget https://github.com/openresty/sregex/archive/master.zip
& \5 K: G2 v0 u1 A! Rmv master.zip sregex.zip; t9 b# A8 |) @/ \9 B
unzip sregex.zip
# [( s$ ^3 b# G$ K& mcd sregex
8 g# C' y# i0 x7 G+ [' ^- v3 n6 B imake && make installln -s /usr/lib/libsregex.so.0 /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
) t) s8 s8 x( k1 fldconfig
# N! L* R, E q1 ?0 b
! h* v5 ^+ J0 D安装modsecurity1 F" O/ r) E( ~4 l1 T; W
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel pcre pcre-devel libxml2 libxml2-devel)』8 m7 S7 p1 z' s7 {0 U
git clone https://github.com/SpiderLabs/ModSecurity.git mod_security! q/ f v5 {, K! s2 X- `: c2 n
cd mod_security) ~4 w7 p) G3 ~( @# G0 _
./autogen.sh 7 x1 }9 ^" `8 s- j
./configure --enable-standalone-module
8 E& i. m! `0 A$ c Y2 \make0 U( J& J8 }$ A- Q2 L' e
. z; B V H: R9 ]
5 c5 p( q6 x. g9 u: ?8 I安装nginx
& t J; B4 h& b1 }3 ?/ T- Fcd nginx-1.13.67 f9 |# c( m& r9 W4 O
8 s, [$ K4 G1 N j' s& ?% c6 X! s[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 , ` I' D# I- T! @% v8 v
make3 E" \* K9 {. y: K
make install' i2 }% T8 U! |) P' B* B% v
# j$ s3 d, B7 e6 Q注:--with-ipv6 已经被移除默认支持ipv6, --with-http_spdy 已经被移除合并到--with-http_v2_module
4 t. J7 G9 s7 `4 r' i j& V0 w
; p# N" M' u4 m1 j+ ]
! l( i+ f7 J! P) v) d
$ g. ^' F0 J5 M0 E* A5 ^' e4 [6 K; ~' l, s+ o
& S& i' q% m& V# s% q
, o3 I0 C( {$ f/ m3 w3 {# k+ D
9 r0 q! W3 z/ U1 Q4 ?
3 h R5 r; a9 ], {; w
! P ?( o8 ?; M! ` |