找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10456|回复: 0

nginx-1.13.6+replace-filter-nginx-module+modsecurity编译安装手迹

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:! ?: J# T. w+ E( y+ `9 {6 f& w
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
) h5 i. Z3 K& E1 \* `% X$ Ftar xvzf openssl-1.1.0f.tar.gz
6 T0 p0 l8 p2 V9 m2 F* C  Wwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz  D2 H: l9 m8 @( R4 W& a9 q" ^. v& \; a
tar xvzf pcre-8.41.tar.gz
8 F. f& Z3 ~' H, k0 b1 B% ]8 w# ]& C6 S1 \5 d* b5 |0 D
wget http://nginx.org/download/nginx-1.13.6.tar.gz
9 M% b$ M4 X( ~3 r) }$ v+ ztart xvzf nginx-1.13.6.tar.gz: H$ ]& {1 {" h8 E; p& S0 L9 T

0 q: T8 m  J% a8 ]  L6 j- `wget https://github.com/openresty/sregex/archive/master.zip
+ z! i1 s& Y# Q4 o" Hmv master.zip replace-filter-nginx-module-master.zip# \$ P1 h1 m, e" ~0 _
unzip replace-filter-nginx-module-master.zip. f+ F( {4 _0 D5 T; E

/ y2 Y$ n6 }# \5 L6 m安装sregex
* J! l! a8 |1 r; S! X& U$ r[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
0 U6 O# ~/ g! c. @wget https://github.com/openresty/sregex/archive/master.zip& ?: C1 ?( d  C. @; X" Y0 `+ q
mv master.zip sregex.zip, Y% s. `2 k. w
unzip sregex.zip7 x2 {0 n1 D! R4 [4 K
cd sregex& O# V$ Y0 H  A9 D- |' @
make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整! L& o3 i) e9 h9 V. v8 S: I  Q2 t
ldconfig
- c" n: T, J/ C$ a+ |/ C& X
8 s" I% @$ s0 c安装modsecurity
4 g  x& p2 [( [5 o' R9 W8 |『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
, {4 P' v2 ], \3 E9 \" ?git clone https://github.com/SpiderLabs/ModSecurity.git mod_security" e9 p+ B$ @5 q7 {3 p
cd mod_security( X7 k* Z: Q! }; d
./autogen.sh  : @! V* H7 |# [  w
./configure --enable-standalone-module+ Z; u5 W( Z2 V4 n6 s
make
2 G, `# b+ c) e7 }
1 f3 K2 X. K' j- F1 j  X3 E; U+ G- p/ F- i4 t: ^' C
安装nginx7 Q! d" L" L' j0 t1 b
cd nginx-1.13.60 M4 C7 z# |2 f+ e/ \$ X$ j
4 @) a/ P- `: c
[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
' |. ^0 T% F& q7 p
make! \2 E5 z/ W2 ]. J9 A8 e: Q
make install
4 z3 R# q1 I0 {/ b" n! y. v0 ~5 [# V
5 J4 e0 q+ `" |/ e9 x注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module1 m9 X" n/ g! I4 a. R

1 @5 g8 ]# r& Z8 b' I: ]: c
' O5 ^, b% \& w" x' P2 e, L7 q/ N: @
* r5 Q; x. m9 e, V+ b' G1 e- a& z. L

' Y# _5 j1 ?' b( e- w4 Q. c
: q7 E; z) m5 c. |2 Z* r2 N' v# b4 k8 x. B, N* `5 H% A

, \3 Q: U! n/ L6 v; k& U+ b$ C, \+ x! }0 @/ \6 o8 K8 H7 H# u; T+ k
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|第一站论坛 ( 蜀ICP备06004864号-6 )

GMT+8, 2026-4-8 13:00 , Processed in 0.075533 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表