找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9847|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:7 w! H( H* J: G/ ~
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
9 E  f9 d& A$ p( P, Ctar xvzf openssl-1.1.0f.tar.gz( k: ~# `! X6 \2 p" T9 |2 m8 y
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz5 k6 G+ b7 J, I" ~9 V: Y$ c
tar xvzf pcre-8.41.tar.gz9 M' X9 o3 L5 D2 {, |7 L

4 g* m7 I" x8 Fwget http://nginx.org/download/nginx-1.13.6.tar.gz& A: Q5 r, t; S4 ]  @+ ~8 h# o* j1 ~
tart xvzf nginx-1.13.6.tar.gz
3 Q  m% w' x) @# t7 \% _3 p* z9 Y% J, |( H* [
wget https://github.com/openresty/sregex/archive/master.zip" j; w  m6 h2 ]' H
mv master.zip replace-filter-nginx-module-master.zip/ q; M  [5 @/ f' ~  b( v  f3 T
unzip replace-filter-nginx-module-master.zip
* x) A$ D2 v$ q7 n+ ?& Y# {, t& p5 q& C; J
安装sregex2 Y7 T# ?. W6 [
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]  U: S  n8 e& w+ E5 w/ g
wget https://github.com/openresty/sregex/archive/master.zip& Y, c0 o# N! P- x, A% K
mv master.zip sregex.zip
5 ]9 h  ?; o8 u7 J- N' Hunzip sregex.zip9 v* @9 L1 a! a8 t; m7 G2 ^8 R
cd sregex. O2 M' x% U0 }- p* [% v! V! a
make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整0 F! ]3 W3 H/ d& }; s
ldconfig
. @* n7 f! f% G7 l+ T7 m
( E8 j+ ]9 T# h9 G安装modsecurity
' {3 n4 L: W- r4 b9 U# U8 S4 b『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
6 H- k- _6 ?8 I2 L+ k5 Agit clone https://github.com/SpiderLabs/ModSecurity.git mod_security& b  I& r4 |, |9 y  |1 O! d1 P
cd mod_security4 n) p* ?1 t, ~7 R7 u/ A9 i6 [, r; h
./autogen.sh  
+ Q4 V5 T# f! l1 \' x0 I( M./configure --enable-standalone-module8 E) y% J. r9 b% K% R6 b
make/ x8 a* L6 O" h. U% z3 H: g
, V( X- z7 [4 E) r
2 l0 \4 A# J) J$ h% D+ x
安装nginx% r' W; J" M" J% Y7 t5 k, ~- u! R4 d
cd nginx-1.13.6- }, A* t3 U6 ~" q3 A/ ?4 Z& q$ n+ x
+ N8 `% t- X% x6 D
[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

+ K" m$ ~6 a) E9 tmake) ~. h# h, Y- |" c
make install. s( J& n/ }9 f# a8 z9 `; E4 Q

0 k4 _# l1 \$ v5 }, J+ _7 B注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module% x0 L! m% Q( K& z/ e' `7 i- N/ {
( \! J1 o5 L6 L. d. V. c% P  N
& l" c( e, f$ n, Q" Z+ k

) l7 A: X" V$ ^2 S* Y
9 `8 B. Q* O& j9 `
" S* X9 Y; F$ d6 u7 L
4 T& A; x, j& r+ f# U5 {+ p0 d2 ~: R$ @6 y6 E" b+ h7 f

" F7 v0 Q6 t) ~. q  ], K# Z( @
& K0 F' o6 i+ c8 E
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-2-7 02:22 , Processed in 0.027516 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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