准备文件:
7 Q( f& J/ W* G9 z3 j3 P0 ywget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
- b7 ^8 l4 Q& i x& V7 Ttar xvzf openssl-1.1.0f.tar.gz
4 \4 V* f$ S# @0 w6 Rwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz3 R) i& Z! U$ Y- M& v5 A- B8 o
tar xvzf pcre-8.41.tar.gz
/ e" g5 B: Q: X2 t# F8 F( n. V$ F0 ~% w5 p7 p
wget http://nginx.org/download/nginx-1.13.6.tar.gz: m8 ?' c! ]4 i1 p# ~
tart xvzf nginx-1.13.6.tar.gz; a% _/ p9 J. L/ x( R! Z; b
2 s3 p1 P. t+ x5 i4 {% w( |
wget https://github.com/openresty/sregex/archive/master.zip$ h+ I s4 Z) n; U% b
mv master.zip replace-filter-nginx-module-master.zip# g+ {/ ]% a5 E" y
unzip replace-filter-nginx-module-master.zip9 M7 D. O: L: A7 g1 M+ I) ]- [
% I" o. j7 l; e" R9 z5 ]# A
安装sregex$ @ S. h6 T7 t; a. P
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块], ^5 h- V. q5 _+ i
wget https://github.com/openresty/sregex/archive/master.zip
) B7 Z6 F9 l) S+ M% K! o2 Umv master.zip sregex.zip/ n, N1 v N) h
unzip sregex.zip, x+ k d8 g9 e. Z' k5 W
cd sregex
/ @) R" }: c: b3 r4 ]/ {make && make installln -s /usr/lib/libsregex.so.0 /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
% I- Z/ M- g( j$ v3 Lldconfig. o6 e. w; U' B) a8 @" s9 ~
. d/ m0 W' \5 l w; @
安装modsecurity6 w: L0 |5 C2 {
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel pcre pcre-devel libxml2 libxml2-devel)』
2 u) }5 W5 H1 u4 X Zgit clone https://github.com/SpiderLabs/ModSecurity.git mod_security
2 K2 {2 U1 f$ R. i1 {cd mod_security9 k( Y. j, y5 l* n1 R
./autogen.sh ?6 N' b; H" g, a T u
./configure --enable-standalone-module: S/ g: Y# C% u3 Z2 Z! n5 G
make
2 n3 l" l7 ^+ x$ ~/ ^- A& `
0 N0 _; h/ w" w: V' \# y
, }: u4 j# j$ k; x安装nginx
- X; R. X& U# X4 Scd nginx-1.13.6
9 U5 A; z% y" r2 B1 f8 K/ k0 X! X$ u' W; g- t7 k1 Z
[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 / @/ A+ q: W6 d
make4 h; I: f( K, f' h1 L# W
make install- U; z C; g# Z+ q8 {& e! W
' T: i) i/ B! Z9 ]
注:--with-ipv6 已经被移除默认支持ipv6, --with-http_spdy 已经被移除合并到--with-http_v2_module$ E* g6 s t8 ~& | X) w
7 o+ a. b8 n9 o. @! }) L, o* f# R, a3 M9 r
* B; G% A- W }) d: O; h6 N0 x8 m% g/ X! P6 }' e
7 z# g/ {8 l6 ?0 R% l( y+ n5 k1 V& |: Z2 R# Z" e1 F) u' w
1 q* W+ n# ]3 h: U* b4 u* G
5 ^& x$ I1 P; [6 H; i/ `/ m3 p& S
% [3 o5 d2 z0 P0 Q2 \5 D* z) E
|