准备文件:
# [. D$ E8 E1 o1 m% `2 bwget https://www.openssl.org/source/openssl-1.1.0f.tar.gz! p% W; k" T$ }0 m
tar xvzf openssl-1.1.0f.tar.gz! X( |% O; b: ?" M% X; ^
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
X* B; m0 O; _. D! Htar xvzf pcre-8.41.tar.gz0 @% o% J* z4 X/ o) C7 c* o8 [
' D) Z; l, E/ T6 L9 j: r5 r- X$ ]
wget http://nginx.org/download/nginx-1.13.6.tar.gz5 X% v5 r6 L3 t- }3 X8 \! L
tart xvzf nginx-1.13.6.tar.gz
# F$ {5 b5 k5 f; {+ i% O9 M' t8 `' J- E
wget https://github.com/openresty/sregex/archive/master.zip- l/ p& h) m9 u( F+ Q( W' d
mv master.zip replace-filter-nginx-module-master.zip& A2 Y0 F3 b$ E
unzip replace-filter-nginx-module-master.zip& M. @, z2 Z2 J. r( Z
' l! M1 [+ p4 `" [) l& v
安装sregex, A; x8 d- g4 }( h, ]
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
& V* j5 i* k$ f/ v, V+ k3 kwget https://github.com/openresty/sregex/archive/master.zip0 {& [( S5 A# D
mv master.zip sregex.zip
8 A0 S( ] S/ f; x' D: h6 z4 kunzip sregex.zip7 ~) X0 q9 e! t/ X
cd sregex
6 i1 x5 d/ j+ I4 F1 [3 N! ^/ Jmake && make installln -s /usr/lib/libsregex.so.0 /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整" @, J- d" _9 b. M" t+ s; N
ldconfig+ b6 V6 \4 D2 J
0 j% e) @! @( {9 z安装modsecurity6 T- M% e0 P8 j6 V
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel pcre pcre-devel libxml2 libxml2-devel)』
8 e- U6 ^0 ]% C9 Y+ d+ kgit clone https://github.com/SpiderLabs/ModSecurity.git mod_security1 s$ G* U. P; g
cd mod_security
* G: i. `- _$ K+ @" j- i./autogen.sh
0 u6 N" z' j# q# @1 M8 |* n; O* r9 D./configure --enable-standalone-module8 x4 A, ]7 _. S- |$ H6 ~1 ]+ X+ d
make6 ]/ V' G7 J+ Z5 j; p
% @6 q7 X$ p# P# F, J# v M3 l
5 p( V6 r: ]# ^9 j7 W& k安装nginx4 U" y! |1 q6 d
cd nginx-1.13.6
( }2 D3 U# R* x) i0 G% R4 k
1 }: B v. d- E: [7 H c, I[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
$ J, r* V* h+ I4 x$ u9 Ymake8 K! { Z# _8 F: Q
make install0 y- d8 d0 C9 \0 |
; O# d l7 Q! h$ K( p+ s+ D$ o/ W Q
注:--with-ipv6 已经被移除默认支持ipv6, --with-http_spdy 已经被移除合并到--with-http_v2_module2 v/ @( G7 N) \- _
6 {9 X( X1 Q* C7 K1 p: M. q) y6 F, n) B% \0 I# v7 u5 n& ^1 @
5 F8 `: S2 z/ a; `$ ]4 L0 I
( I- h# I( F9 e
+ ~6 ]0 r8 t3 f o9 A) C B) Q( W# }$ {1 f2 x
$ a& h. s. [1 G/ x5 ~" [
( `3 v- l; G2 q' i5 I
) }- O' T: H- M$ i: q/ t9 t0 y
|