找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 8436|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:# f! P' [+ V2 d+ t
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz. S- X7 \1 M, P! B
tar xvzf openssl-1.1.0f.tar.gz
) u. u- v, f$ B- c: uwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
! l: a" @  n3 ^tar xvzf pcre-8.41.tar.gz
! X- P- S% q% w
( S4 `, g% G8 xwget http://nginx.org/download/nginx-1.13.6.tar.gz& B+ w& ?* }" y* ?
tart xvzf nginx-1.13.6.tar.gz# L8 Q  e5 i3 @9 J; W- d* Z1 N

% N2 v8 Q' R9 ]. n# u( @wget https://github.com/openresty/sregex/archive/master.zip
! ?, Q- h! d( d. ?" `7 S. {mv master.zip replace-filter-nginx-module-master.zip9 S8 t  R3 u6 J+ M+ p
unzip replace-filter-nginx-module-master.zip
- l8 i" R5 {( `
$ l) w0 V: C) m& v3 X# j7 T0 N& j1 j1 O安装sregex
+ ~& D6 @, }" X) a[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]: I8 {2 L' r+ s# |0 D5 }$ @/ E8 I
wget https://github.com/openresty/sregex/archive/master.zip! R2 _1 c3 o# R4 K
mv master.zip sregex.zip+ W5 A8 g7 Z4 T" m& I$ Q0 T
unzip sregex.zip
5 ^9 d; e1 e1 I5 h+ T( X6 Ocd sregex
$ V+ a# ?8 W; u% Y1 e/ k! s+ jmake && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
( ~( m7 u' u* v* w+ D+ xldconfig
$ L; y" f, P7 u8 i
) h- g, c' }5 \, g5 ?5 R3 Q安装modsecurity0 X# E9 |4 r' }& Q  `+ I8 U7 l; i
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』" a2 N- J* M+ y1 }; A$ p% `! C' Z0 K1 d& e
git clone https://github.com/SpiderLabs/ModSecurity.git mod_security/ d! b0 C- p( [4 X# w+ f
cd mod_security, o" z1 x# b0 t" O" E  i# h
./autogen.sh  # J! d4 j- p$ D" U( `( A# D# t
./configure --enable-standalone-module
4 b1 p+ ^- [+ {5 tmake
: u& b% z: n$ Y/ d6 N. X" |$ O3 R! v
( H  e! j% E% l% m5 L  p/ T$ ^8 V+ R; g5 L
安装nginx5 q$ I2 d# [, ^4 ]. P+ i
cd nginx-1.13.68 ?' W0 ]8 N8 d) G/ A
. V/ H6 F9 N* n2 W- q7 I
[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
6 B6 _0 B6 T4 `6 |
make
0 J0 Z# V0 D5 C) G7 ?make install
% L' O" }/ L  t- x( Y4 j* }; z$ l% _3 o" c* L8 x
注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module
7 n5 M4 H2 ~  N( ~% @' G/ a# N& a2 h+ Y
$ l0 Q3 Y5 x+ M; K

* \3 c. n; G! I% X) Y. u! ~4 K4 d# S5 g  o

$ m* m6 C: h8 I* K1 K2 S: U8 C. o/ C- W

4 i7 m6 y4 c* k6 F4 u! O2 ?
( g) G' l: T3 d7 _7 S' l; X' f8 \9 a1 E
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-7-18 22:47 , Processed in 0.076354 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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