找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9223|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:
# v5 W( z. M$ }) V: h: `wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz0 o4 Q% S) H& E8 u9 G: G
tar xvzf openssl-1.1.0f.tar.gz
- c: e6 A& f( s0 S, c3 D4 vwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
+ R5 `5 o* A& F/ w6 Jtar xvzf pcre-8.41.tar.gz; S# Y& Z' q$ F

2 }# `4 G0 e- }wget http://nginx.org/download/nginx-1.13.6.tar.gz
2 N. K7 E- L3 T& a. m# k# b& Ytart xvzf nginx-1.13.6.tar.gz6 a+ Q% c8 j9 l4 U6 `' w; U) T0 C

# |0 |8 t; r5 }. Pwget https://github.com/openresty/sregex/archive/master.zip
; Z: N1 @: C; o5 @mv master.zip replace-filter-nginx-module-master.zip
; V- Y, ^; Q- Q9 y3 aunzip replace-filter-nginx-module-master.zip
, `+ ?4 l8 }$ I5 z+ Y
; Q" ?( J6 T' Q1 y, O) p) q1 i6 D  [& r. M安装sregex) l& q: w) f  h1 @; N
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
- U8 @1 d8 C% C5 w; v$ Gwget https://github.com/openresty/sregex/archive/master.zip' [( N( l# d( }! J2 b
mv master.zip sregex.zip
1 V0 e: {  N: l$ S6 G( lunzip sregex.zip) ~+ C; l6 D+ Z3 T" E
cd sregex7 O% L" A4 z& m: u/ G8 ~
make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
& F+ d) m# G% Z' Aldconfig) c; k1 w& _! T; B6 O: M* j3 B

1 _& `3 P8 H- s4 Y, G! J4 ?6 n安装modsecurity: {: P3 K7 g3 i3 Q
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
% W* X/ y5 ~. z! w, Jgit clone https://github.com/SpiderLabs/ModSecurity.git mod_security# P- L: U0 x- {6 z/ ^2 j
cd mod_security: N' W; C9 x. e4 e
./autogen.sh  
! T* f; u% I+ Z* h4 T./configure --enable-standalone-module
9 _9 A' d* Q7 }$ @9 ^6 Qmake
& _  I, @6 @2 ^. A$ ?
4 O; f) J/ ~, Y% w" g+ U
  g) ]  l4 {+ U8 W% x安装nginx
3 I4 s+ U( v0 vcd nginx-1.13.6* \- f0 c# ^- m2 j1 N3 h* J( Q

0 [; `2 B" U3 P) |5 d6 P
[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
" }8 r) G. z8 j* r0 s
make9 g# M3 Z6 o# b* }
make install( I: E/ _" M. W# N* C
1 T1 G  o' x' h  L! f. e
注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module1 [' P% O9 t' [8 u2 O* T
# ?2 s( E1 u$ E5 @

) D: H8 h. f8 F. r2 w5 m2 e$ u5 r; M9 k4 b* a$ H; }  C3 M
1 c, O7 b3 _* d: x! f9 K

0 o  i$ o* s& `, N. R" y) N9 U- d0 r, j1 ?, q1 m' {
+ E* O4 d4 `3 Z
9 F5 w& _% \" _; r
5 r  i( ~2 f( S% t  u: h
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-11-16 04:35 , Processed in 0.071532 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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