找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11115|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:
3 u, U2 }2 n3 p- J3 ^+ }8 R* ewget https://www.openssl.org/source/openssl-1.1.0f.tar.gz& K+ u% Y5 }0 W. s
tar xvzf openssl-1.1.0f.tar.gz" ~9 j. G0 D# p4 o3 M" g- O
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz4 |- C) P* p" `  Q
tar xvzf pcre-8.41.tar.gz7 q- H% [7 I9 i0 a4 w$ s
8 V6 ^4 I5 }# e/ Q1 T$ `# A7 n0 D, D
wget http://nginx.org/download/nginx-1.13.6.tar.gz
( ]& h# I4 L; v" rtart xvzf nginx-1.13.6.tar.gz( a3 a0 A3 V/ s/ ^$ n
% P" T) ~7 V  p( G/ O" e4 T
wget https://github.com/openresty/sregex/archive/master.zip# g+ J. |. c1 y' O3 l
mv master.zip replace-filter-nginx-module-master.zip
' I7 L& b) ]0 ?5 u7 X: P- Yunzip replace-filter-nginx-module-master.zip; @1 _; A7 W( }! m0 Y+ I

. _, j; K7 M' h3 R安装sregex
6 G! I$ p5 d# U[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]7 b$ n9 s/ ^, a" I6 @9 I/ D( ]
wget https://github.com/openresty/sregex/archive/master.zip' D; @" k% g, S8 Z4 I, O
mv master.zip sregex.zip( i2 ?* w9 h6 z6 A
unzip sregex.zip
+ y2 s6 B! Z2 Q3 A+ P* F/ @cd sregex
3 K5 d6 V$ j. F- hmake && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整: Q9 o  @% x. p7 C8 @8 U- q- ^3 ]
ldconfig9 k4 _: f* A9 q) L6 X! ?5 }( \  ~

) R6 [/ M# {2 Y/ e2 Z6 S安装modsecurity, H% ]# ]& V: e; z6 k; u/ r
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』3 t$ c  z: A" H$ K: t. R
git clone https://github.com/SpiderLabs/ModSecurity.git mod_security
, O$ D( r( V; E: jcd mod_security& @% e% ]: X1 b5 e$ I
./autogen.sh  
. r, G$ F/ t1 @./configure --enable-standalone-module' T  ]+ q% x7 A- ~$ g: @
make2 X0 r+ i0 }5 r! k3 g
# e1 _( C8 d1 s2 z$ [" {
$ P% V% s- m* _6 J, F
安装nginx8 S, P2 `* U6 `, ^6 n8 W
cd nginx-1.13.63 c7 S5 p* v: _* E5 W( ?/ q

* i- {# E; ]* R
[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

% P0 o, K. g3 `7 bmake
1 K4 {( A- r% q7 T9 bmake install2 j9 u; K4 q' }5 t9 L5 _. Z
& R# ]1 Y# m1 I1 r1 R8 S$ o) W6 w
注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module
# i+ @7 S4 s* d. X/ ]' ?! R1 r/ E' h' u

! v- l6 A4 y3 r4 a! A6 g! J% ~! W/ ^( L( b

  U! i5 f- M) G% o4 b" T; T* |- Y' W& V( c: S) Z1 J% W. u3 Z
& {2 z& [; m! }5 m6 X, K$ o
$ B7 a/ X: o+ s8 ?6 x! I

+ K& s8 n9 W8 N3 [- l' K) ^1 a0 Z4 W0 ?; e8 `
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-6-16 07:12 , Processed in 0.074973 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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