准备文件:
7 [; k1 \$ Z; m' s! Awget https://www.openssl.org/source/openssl-1.1.0f.tar.gz: ?; }6 l3 a% u t, N# b% K
tar xvzf openssl-1.1.0f.tar.gz
- g. b9 c& {& ~) ]- swget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz- O( V4 F/ \: {7 j+ Q4 p- f0 X
tar xvzf pcre-8.41.tar.gz$ F& {+ |4 c: O u* E
; g4 n! y2 b% z& t7 }, i
wget http://nginx.org/download/nginx-1.13.6.tar.gz, H* l& Z# ^# d2 c4 {. M, p/ H3 \
tart xvzf nginx-1.13.6.tar.gz4 h% t- Y$ h2 A' g
d! B1 q+ X# b0 l0 k9 ?* ?
wget https://github.com/openresty/sregex/archive/master.zip
3 X+ E8 |% ?" u. ]9 p: B% l: \mv master.zip replace-filter-nginx-module-master.zip. i' l% x* R" g1 T. ?
unzip replace-filter-nginx-module-master.zip9 F3 Z Q' j$ I) I {
2 G* |: q- J- @1 b
安装sregex! o5 }; f8 a3 i- l* N5 U0 O1 o/ P. g
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]: q' o% H) K& _4 x) {* f
wget https://github.com/openresty/sregex/archive/master.zip4 L" ^; U8 u6 H( J! f5 a
mv master.zip sregex.zip0 F' m( K) S5 y
unzip sregex.zip
@* E/ t9 L+ r+ y) t% mcd sregex4 C7 G% z/ N- R7 K
make && make installln -s /usr/lib/libsregex.so.0 /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
. X0 k( }9 v' g% L1 j' s0 l' kldconfig
, b' ~9 {$ y6 V5 Y9 D9 K7 S7 l- c7 C1 ~; l+ ?5 [8 J3 S
安装modsecurity! w9 G$ b# {9 [
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel pcre pcre-devel libxml2 libxml2-devel)』: W8 s: X5 g( O! N9 ?$ J4 E
git clone https://github.com/SpiderLabs/ModSecurity.git mod_security
: Z/ _5 k& [% l! ?cd mod_security" i! w* i! f O; h' d6 Z
./autogen.sh
# p9 ?0 h) G/ S8 I; v./configure --enable-standalone-module# a' V5 W4 `: T6 t! `( l* i5 e" W/ t
make
4 w' O7 _7 k. h- g1 U- H* P* s# C
* O7 T* P# w4 ?) Q0 _1 M' e
4 N1 \0 E* I1 r4 W9 Q# _1 N3 M安装nginx3 j' R# O0 s [! n5 E$ O, H" x9 v
cd nginx-1.13.6
; T) Y1 @% v0 r2 W# q% L5 ^: P2 @4 O$ i# {& z# U+ G: {
[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 3 {- A5 X. Y6 Z" v; s7 _
make# T5 C1 a- a) ?
make install
1 [ S1 e5 z( _2 u7 e" g; z' R3 q8 {. j. R5 K& n$ q( S/ C P! T
注:--with-ipv6 已经被移除默认支持ipv6, --with-http_spdy 已经被移除合并到--with-http_v2_module, l6 C! V" \: i7 O: @
( E% j8 d N2 n9 D! j0 q9 y. |* g
' [: N- J$ c; n* t k* a5 Q1 ~# `5 k6 [$ s$ c1 p) b- e
8 _8 A+ {* V: P$ @) I) d, X. ?( }, w4 H4 c
/ d8 P$ F7 T1 P
+ u+ C j6 i4 L2 e4 ^* J# U" M* D8 B9 g' n) P5 a, [; y
, E- p6 { |/ Y5 R' [
|