准备文件:
J& B* c8 U" o3 `1 n8 D% [wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz7 k$ A7 M9 p9 i+ M7 a
tar xvzf openssl-1.1.0f.tar.gz1 b: F5 a: }" C) u- q$ n3 m/ b9 _4 l9 Q
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz* d) B, M; U6 O) R$ R0 ?: n3 Y
tar xvzf pcre-8.41.tar.gz
& W, b1 u5 g: c; ^: I7 N e( h# e j
' I: R' ]" l8 R. ]4 s6 p3 c! cwget http://nginx.org/download/nginx-1.13.6.tar.gz+ C( j. i( A) H" H
tart xvzf nginx-1.13.6.tar.gz; N" D* c1 ]8 m# C* c. o
/ z$ b6 x. m2 K1 W( q9 m9 ~
wget https://github.com/openresty/sregex/archive/master.zip9 O) a0 k* h6 F9 `
mv master.zip replace-filter-nginx-module-master.zip
Q2 z% R- g+ |; Vunzip replace-filter-nginx-module-master.zip
5 Q2 E" b$ T) q8 i0 e' K: f4 @ V0 G4 X* k% {. W* C- ?" U6 E6 h
安装sregex2 k# Z: \( d' X, Q
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]2 h8 o: q5 n2 A7 j) A
wget https://github.com/openresty/sregex/archive/master.zip0 w/ k% W- l+ k i' p
mv master.zip sregex.zip+ T" X2 M6 j, p, H2 U
unzip sregex.zip
: H2 g; @8 R- A2 C& Lcd sregex
: ?9 I% n. W, a7 b( K3 N& R2 t) Amake && make installln -s /usr/lib/libsregex.so.0 /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
0 f z- J# w, ^, p1 Q% X3 uldconfig \% T( S5 q i: c* z
9 j- E; ?# T% I% T8 m. h: t# O安装modsecurity0 G$ k9 Q5 j5 D, L7 ]
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel pcre pcre-devel libxml2 libxml2-devel)』
- v6 P8 d c/ A& X# ~git clone https://github.com/SpiderLabs/ModSecurity.git mod_security" R5 P) k( Q! o" h( ?8 F6 V$ x
cd mod_security3 x: E: `- D) M0 h( G$ E# k" J
./autogen.sh
# M, l2 N1 x$ _ e% r./configure --enable-standalone-module
0 C( X( s6 ]- Y' `make
6 @ t" |8 r5 J R2 K6 B4 _/ P1 q v# [' n% g% A& p E1 b" l: t/ b! u
" p1 S8 d7 \9 f/ \- i, m! [8 ?
安装nginx
3 S3 M& `5 Z0 }- v- }cd nginx-1.13.6
" j9 }& F) _4 t; H5 w/ Y3 J$ V
! r) p B6 I( K k8 H0 f, x; E _[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 ' u4 K1 G" [3 W. ~& W
make. k: t' Z+ v6 b2 c, p
make install
7 `+ s5 B I3 T' {- M5 \, W3 R
4 L+ k& v' l4 K. k1 L注:--with-ipv6 已经被移除默认支持ipv6, --with-http_spdy 已经被移除合并到--with-http_v2_module& s' u. ?7 R2 Z( l5 c
3 n9 C* c# I1 X: w! W$ _) k! P! R- p# j
$ K4 y, n& ]3 ~+ G" m
; |9 {( e$ c7 D; V& y3 Y0 z! |/ a
* t6 b! V1 K" \+ e; J0 x$ m* V) w: ?- d; G. ?* X* M: M6 D
1 ]- j7 Q9 z/ z$ F
1 _2 i3 T: i2 n
) v$ C3 u" \6 X. q+ j: m( f: w
|