准备文件:
6 N% m/ |. k0 x8 I$ K5 g2 w l+ cwget https://www.openssl.org/source/openssl-1.1.0f.tar.gz% i; t- t$ x6 t9 b" C
tar xvzf openssl-1.1.0f.tar.gz- s0 y! P; c* ?! \& M
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz* {" v p4 _. e7 P/ L
tar xvzf pcre-8.41.tar.gz$ u, W) s, K" R, e
9 P4 x+ _8 b( D- |% l bwget http://nginx.org/download/nginx-1.13.6.tar.gz; }7 Z1 [3 K9 ~( ?
tart xvzf nginx-1.13.6.tar.gz
) ~# p8 R4 o- O! }! U x- w. \* j; V G W1 ?! I
wget https://github.com/openresty/sregex/archive/master.zip
+ l- D" _3 W# @. fmv master.zip replace-filter-nginx-module-master.zip; Y6 A" \3 c; @4 O2 l
unzip replace-filter-nginx-module-master.zip3 z! }0 i" ?2 a2 @
- v+ {" ? s2 `! Y0 `安装sregex8 t, S! q- ]; l/ I
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
3 E5 }5 U! Q5 Owget https://github.com/openresty/sregex/archive/master.zip3 x) d6 h% x G. K! O; T& I- p3 l6 @
mv master.zip sregex.zip
* d2 S$ {8 E* y' } Ounzip sregex.zip
, `* \5 t* x4 I& G) |cd sregex
W. Q% {0 A8 k) k; Q5 g- Smake && make installln -s /usr/lib/libsregex.so.0 /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
7 s+ S: ]$ k- R/ Nldconfig
; a5 p, y" A8 k' k+ p
; ^- V; S, t& L1 G安装modsecurity( }# p8 {+ F3 m/ k0 i
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel pcre pcre-devel libxml2 libxml2-devel)』
& v" G$ ?- q3 X! \- C- w& J- }# Jgit clone https://github.com/SpiderLabs/ModSecurity.git mod_security
- |1 m2 U& h/ ~) I# Qcd mod_security1 ~ f! t3 d: t5 |
./autogen.sh
& O( R7 @5 E' X, G./configure --enable-standalone-module* e9 G, W8 U4 C
make
7 y3 P6 x' y% \4 u* |
% J+ W8 Z6 o1 d/ U7 ^5 }6 R) ?4 R$ ]4 O
安装nginx% t$ N, e. V$ \( q7 B9 ^# T0 ?# c1 p
cd nginx-1.13.69 {3 t6 t' B& N0 E. j9 I
$ W+ d* D9 y) |- f. K[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
) X* H) O2 q2 t9 V( ^5 [# amake
5 N; C; H2 c! |, z$ smake install
. n/ Q9 `$ z; b+ F5 N$ T8 {; N' p9 ~ z6 E# `9 g/ J
注:--with-ipv6 已经被移除默认支持ipv6, --with-http_spdy 已经被移除合并到--with-http_v2_module
- \/ p$ F3 J+ t, [( X- T. w: u7 S8 y$ U& ?
& r4 `- q$ I6 o- z( e
, |# R, i2 m3 p' \ c* f3 m* G3 U* Z x0 @& m* @* L5 [
" ^+ y, p ]3 J9 M
$ x$ e! Z0 t: \6 b$ w2 a9 N4 j
; P g( a0 a( Q. z
6 }& U& S' L8 J. R% p' Z! z% `0 T% T, d
|