找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9492|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:% K  {4 R, _7 c$ d/ y! H0 Q
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz+ ~0 J+ G0 s- H( q1 c
tar xvzf openssl-1.1.0f.tar.gz  X) ], k1 m0 }* A2 P* C: V
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
6 R' F* t8 l& u; e6 G: ?tar xvzf pcre-8.41.tar.gz. M# e5 {- y8 C" |+ F
! |# L$ Z" Q9 H% }* d
wget http://nginx.org/download/nginx-1.13.6.tar.gz
5 V1 [) F& @+ c, V) m/ mtart xvzf nginx-1.13.6.tar.gz9 r  z1 N  [" T6 y9 S6 o1 N5 Q0 A

0 j0 o+ @5 b7 \* @wget https://github.com/openresty/sregex/archive/master.zip4 E2 S, n# [: o( V: B) i* n3 {/ _
mv master.zip replace-filter-nginx-module-master.zip$ H  i$ Z& }( C) z
unzip replace-filter-nginx-module-master.zip
) w2 c1 K& t' v8 H7 ?( L* m  |
& i$ s6 s/ d* Z- w6 [4 Z1 }. l/ }安装sregex
1 [+ z" e- z+ U$ C[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]! U: F' q2 Z0 v2 D4 N9 V: _4 t
wget https://github.com/openresty/sregex/archive/master.zip
5 O. \* d3 z) x4 e5 N, y+ T* Cmv master.zip sregex.zip/ F: p3 J5 t6 z; M) g* D
unzip sregex.zip
8 k+ ^- g( r! g( ]cd sregex
& e: P3 N1 P( G! }! w  g+ N; kmake && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整7 E  \" q9 X* S- c0 d
ldconfig$ F9 _. C8 ]+ y& F( @

  s% \* C+ i1 t$ {* X安装modsecurity
$ K# ?8 I! w- R+ s. |: i, q, _『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
0 L6 Z0 ^4 H, ?2 C2 z4 q* \git clone https://github.com/SpiderLabs/ModSecurity.git mod_security
, f  C' u& F  ?. c! |cd mod_security
2 N* r# y" F( a/ B* F% g; u./autogen.sh  
- E5 m2 U% P- S) U( `) F./configure --enable-standalone-module
6 F. h& S. I$ U- qmake
( ]5 V5 [, }' W" S7 A& K4 |2 B7 ]  ]5 n  `5 n  G
" ~7 s. S- Y# ~8 |2 ^: y+ O. [" m
安装nginx
& A' E. e+ k1 `& H( Dcd nginx-1.13.6
* D2 l" a& U) E, t! @' c. A+ B  T( ~5 y- _
[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
" I0 s5 n; l( f" Y
make
& ~0 l# x* b, ?) R" N4 Rmake install7 N2 k& q. }1 x2 v  z$ O$ C

; R: C0 M7 A/ H3 ~注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module
, z! I6 [0 z$ U* Y# q+ w" ]. F# c, p
7 T# Q8 v, U" p/ }. w- c6 G
4 W" e4 U" }) @- e$ P
1 d$ A! e( _9 y8 S* ~9 N  U2 L5 l
$ }( @! L& p& C7 Z% |3 ]
5 K& e1 K8 g6 e1 m/ Y6 u' {9 e1 O; p  ?* T: d5 C

* d+ ]9 g. M: a" K+ ~
  T0 I  ]0 g4 W5 E+ o* N8 i
2 c8 q. ?8 }* F2 [
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-12-16 21:26 , Processed in 0.043708 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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