找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9061|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:
5 J3 M& \- O3 [( y9 p. |3 }wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
0 y5 w) W& O( @' K* P9 }tar xvzf openssl-1.1.0f.tar.gz: X- w8 f! W9 c% L4 B; B# ~6 f
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz' J8 f0 Y% U' c' a4 M. p' H
tar xvzf pcre-8.41.tar.gz
( P6 t1 ]. L/ Q! v  F( F# V* h6 x& K
wget http://nginx.org/download/nginx-1.13.6.tar.gz* @: I3 ~" y( j
tart xvzf nginx-1.13.6.tar.gz
* W* |' P2 b/ k
8 x% O3 [  l9 j+ z( a0 {' t. `wget https://github.com/openresty/sregex/archive/master.zip
4 }* b% R9 m* b4 B1 w6 Bmv master.zip replace-filter-nginx-module-master.zip
" L( f3 w. I, u$ Yunzip replace-filter-nginx-module-master.zip
7 I5 P: L7 v) H4 W" g6 q* V! ]5 B7 E* u$ Z% P( i
安装sregex
+ [8 ~; G9 o: D8 M[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
. y1 t4 n0 e5 p9 r. Pwget https://github.com/openresty/sregex/archive/master.zip
# r( n5 d( `" N& g8 q& h2 omv master.zip sregex.zip
0 S- B5 {4 l  T7 c0 O/ Z1 j% O! q% d; junzip sregex.zip
* I4 E2 l: ?8 y* R2 y2 ^+ ?cd sregex
8 Y' b$ F9 H$ Y! u7 wmake && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
9 d3 q, J" L( J) Y9 w% _  ~; m6 B) dldconfig
! k! d& w2 ^- x5 L
  q% B5 v+ B/ T9 Q1 V0 _7 l安装modsecurity
) O! e/ T5 ^2 t# J9 j『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
; u2 C7 Y; }, b, t6 ?  \git clone https://github.com/SpiderLabs/ModSecurity.git mod_security, o3 s+ Q- b- D. W" W+ r. w
cd mod_security: @( Y/ ~3 {3 ^/ \2 m9 O
./autogen.sh  
* y/ a, u( B3 N& |./configure --enable-standalone-module
- P  U4 H) O/ Q7 ^# F( kmake) y2 z/ V) {; x

4 D: j# |9 N) l1 W5 |, s9 W% ?0 L9 s& C
安装nginx- ]) o& Q' |* u5 T& \# T
cd nginx-1.13.6+ {; g: R/ n- a" f7 ^

+ I- O% `) z0 F+ 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
3 q. X* j0 f( e1 |' {
make
$ }, h2 H+ d- u, o% ~# Emake install
5 h2 P  |& g! i+ X" F
% u* J* |* o) O6 d: [' i; a注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module0 q+ v0 O5 C/ s+ q- W

( Z  \' l9 j4 ?! D% \7 c
% |+ N3 i! ?4 X8 ?2 k5 E
7 T+ \0 r- `) }4 x) U$ L; `4 q9 Z5 A) ^
, k8 T" q; i$ \& k, l/ V+ H4 D
6 Z, P' a3 ]" o( G0 Q: _) k

: a7 T8 w) [5 `. l6 E1 w+ A- E. }3 g& @( \1 l9 p1 Y

( h2 [5 }2 @0 Y
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-10-28 22:31 , Processed in 0.053523 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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