准备文件:
6 \* s7 e; _4 g( P1 q6 L, `. |wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
8 G) t, l+ `5 C4 h0 Utar xvzf openssl-1.1.0f.tar.gz
* y4 B" L, u' K4 J9 \( u% }, u+ qwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz" Z, }: w- s, f6 D
tar xvzf pcre-8.41.tar.gz) d0 H4 f4 b1 i" ~7 @) X( B
, i* y0 t8 k+ T u
wget http://nginx.org/download/nginx-1.13.6.tar.gz% H4 O6 ]/ L& }+ L8 S a# O) ~% R
tart xvzf nginx-1.13.6.tar.gz
% \! m5 l3 c! T& G( S
7 @/ K" ]: [8 e/ W" |5 h6 Ywget https://github.com/openresty/sregex/archive/master.zip
* u7 F# P P+ G/ X/ {mv master.zip replace-filter-nginx-module-master.zip
% a% I" d# l4 V. R4 Munzip replace-filter-nginx-module-master.zip$ `7 g4 ^# x0 Z
1 m1 ~ O8 \; k( o
安装sregex3 m4 |6 B- o+ N4 s( @ a
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
$ e5 w+ K: |, ^1 m5 owget https://github.com/openresty/sregex/archive/master.zip
! ^! `6 X% G" w6 Q8 Xmv master.zip sregex.zip+ _1 x& ~! `. M3 w+ ]
unzip sregex.zip2 Q3 W0 w6 b4 L* N) Z
cd sregex
: q# B; i; V+ G: Wmake && make installln -s /usr/lib/libsregex.so.0 /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
/ @' j1 |5 N6 N, \4 n9 \ ~ldconfig
1 J% {8 W& b: |# J( }- e
$ t2 C, r4 G, y5 P+ ~; D ?安装modsecurity
+ t9 u/ v, B! k6 k% T w『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel pcre pcre-devel libxml2 libxml2-devel)』
$ h6 y# m. M# l5 ugit clone https://github.com/SpiderLabs/ModSecurity.git mod_security, S( ^) o+ U1 ]
cd mod_security
5 `- g t' Q2 i./autogen.sh : ]; E3 s! m1 T+ P" ]: w
./configure --enable-standalone-module
8 v, z( I A& E8 I$ y: smake
* i* t$ P4 j1 M9 \" n
5 y' T. N" ~0 s0 i. x5 j& M+ `; v' i8 O& y/ G# t' \5 K6 J
安装nginx1 F, p- A! H( f+ Z8 d5 N9 Q" F
cd nginx-1.13.6
! B8 A/ p% t$ k, R9 X$ X3 w, e' `$ v$ \/ s# t ?/ y
[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 . l2 {6 i5 t* \1 K! ?' ^. G$ V( f
make
: ^' }1 m( h5 @6 w+ C- u6 g/ Wmake install
8 S. \0 D9 U' ^- @( [$ w
0 N& D) ^0 s# L0 t4 \5 O" a! Z( M注:--with-ipv6 已经被移除默认支持ipv6, --with-http_spdy 已经被移除合并到--with-http_v2_module3 A ?* [- O* t$ @) S; e
5 e& F6 ^! L2 i8 t( q
8 }5 u* B5 B8 d7 p, j
* D* Z* H6 t' I! v w. X
$ O' w- p- g. M- N: E( L0 E* m7 \$ N1 G5 ^: Y/ N' x( M
* W$ v8 e# |7 N: v
f3 N0 u% q/ ^/ ]1 Y5 I, a; F$ f0 b
9 m$ ]5 _2 w% D) V3 x8 H! [3 }5 E: @" \8 y+ `) Q
|