找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10014|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:
# ^2 Q6 P$ {( r  O5 N/ a3 _* Kwget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
. J3 i$ _' @3 Q2 a, e( [tar xvzf openssl-1.1.0f.tar.gz
4 _, }. K: d, r, Q6 O% Swget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
! L# h8 |5 ]  `; @' |tar xvzf pcre-8.41.tar.gz
! D  u& |3 R9 o6 E( l4 Z
# Q- t' Q0 P' P% T, p3 c: e5 ]wget http://nginx.org/download/nginx-1.13.6.tar.gz* C$ H) h$ |" [) t  U% q
tart xvzf nginx-1.13.6.tar.gz4 D8 l" F% I) Z! V9 F4 O

, U6 l; t" _" \2 ^6 Dwget https://github.com/openresty/sregex/archive/master.zip" x+ U% {  M9 U
mv master.zip replace-filter-nginx-module-master.zip6 o; N  |  F  M0 E9 q6 o, O
unzip replace-filter-nginx-module-master.zip# t4 C" |! G- f  P% T

% b# T- M5 {7 J* P1 y* ]安装sregex: O7 S% S1 _8 O, y8 ?
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]" j& V" R$ n# Z7 @: T
wget https://github.com/openresty/sregex/archive/master.zip$ `, |, F9 k4 c. H# c1 Z
mv master.zip sregex.zip! a7 A0 P5 A7 d: O1 h9 P
unzip sregex.zip
# w/ p% L6 G: }, y$ Acd sregex
5 c8 k+ a) g" C, ~7 l1 j2 f0 }make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
) Z/ ?5 q$ l4 G9 ]/ d1 wldconfig6 ?, D& a5 u# \; u7 h; h6 {" E

% C( z! l/ B' O安装modsecurity
) D" g; }7 q  [『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』8 Q% @) ^! [1 J  v6 m, [
git clone https://github.com/SpiderLabs/ModSecurity.git mod_security; L- F# P" s8 i/ |( |& n. w6 u( A
cd mod_security
* d+ l0 x" d5 ?3 x( O' @./autogen.sh  
, v- J7 U% f! N! d, t  d; w' H* B! e./configure --enable-standalone-module- a+ i* Z2 w* d1 W, H
make- U! l3 e5 {2 C, ~' x0 t: `

+ }. w7 s0 W; ?* ~. Z7 R6 N8 G. u& ?1 }: V8 P7 ^, [2 g( S6 |
安装nginx
: z2 Y& Y! I, V3 e. S9 ccd nginx-1.13.6. P9 E; U% U5 w9 e$ p0 M

6 U1 a: D9 E/ g! f2 I9 {5 [' \
[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
1 Y+ ^9 w1 }( z) A+ A9 F/ O$ l
make
1 o0 N- q5 U; F: u5 lmake install9 s$ R4 l1 I) M" v  a( h$ L
7 g6 a4 I6 g* J
注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module5 h! e0 i  c& C# f

: t0 a7 |; X0 L' J+ \# d- k8 q8 h6 ~# v# S
7 Z4 E; S$ C- n3 T
3 d- Y) n6 D, U  G3 H

0 U/ N( ~3 z) y& g
' f0 K2 R/ B7 g3 P2 n2 d& p% t  P$ `1 V8 N
+ I/ y' H* D9 d! M
- S  v0 U: [+ \! H# v
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-2-26 10:34 , Processed in 0.055760 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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