找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 12350|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:
! ?) u7 t5 k) k' G9 Nwget https://www.openssl.org/source/openssl-1.1.0f.tar.gz3 X% A: w  Y# w; Z
tar xvzf openssl-1.1.0f.tar.gz
' p7 ]' r+ W& ]8 Wwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz& a( O9 `; v4 ?. y, L
tar xvzf pcre-8.41.tar.gz
; g* e: H- q4 o1 I- @4 G6 T& s8 y! h! C+ {
wget http://nginx.org/download/nginx-1.13.6.tar.gz' p$ [7 M: [8 M5 L
tart xvzf nginx-1.13.6.tar.gz0 J/ R! C3 d$ k6 b' a

1 x' w1 @" w$ ^$ w; F% f" Ewget https://github.com/openresty/sregex/archive/master.zip/ y% l' R( i& N: e( x
mv master.zip replace-filter-nginx-module-master.zip  S& G- ?- N; T9 d. k  K8 m
unzip replace-filter-nginx-module-master.zip
- L' f8 V; n- o% c' l8 Q; ~5 o# e& T0 d1 O, [& n0 @
安装sregex
# O" o: w7 }, c[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
2 k4 f1 a- \4 U  N3 Twget https://github.com/openresty/sregex/archive/master.zip& _9 U- @0 P1 q  D6 o
mv master.zip sregex.zip, A0 G" |& s/ Z1 S$ x
unzip sregex.zip& ]% r+ c" Z" N' S2 o# H
cd sregex
/ U8 ]3 A6 u* H5 W+ g* G) z4 omake && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
! J$ x. y# r& U$ J4 vldconfig
# k* t4 H+ T0 M- ^% b5 M1 x; L. x1 F. w% v( G) x' k
安装modsecurity
$ S' Y) A3 x# z6 T  e, C『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
7 [) O  Q9 Q* T/ h) h: S, E! U8 W  |git clone https://github.com/SpiderLabs/ModSecurity.git mod_security
7 _1 f( q$ _3 ~8 Vcd mod_security
* \2 o, N1 ]) W! t) H./autogen.sh  ( s0 Z+ J% P( l8 M/ H; H& |  A
./configure --enable-standalone-module/ M( D. B; |5 w8 V7 M
make
& D5 ~- l* C# B' G  f! p' ]1 j+ |, T2 B4 W/ b+ M1 I& C

( A1 O* C  \8 u: j* }安装nginx
) D3 |) T3 U/ {! Pcd nginx-1.13.67 L' p2 Q+ g3 u! k& u! U

  H) R% ?, a: Q
[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

) N& L( h2 S" ?& i' m6 Q0 c4 qmake$ p) n( P7 `! L9 y; H& [
make install
  x; l2 z, y& z$ o. v. T: H
' H/ l# z; Y4 ~4 v- o注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module; y+ o0 l  `( z3 [. _- z) l

! v. a' x3 S- y' {
* ~% B) x5 S' E- f7 U
- Q! V8 k0 o2 p) T$ H0 ~9 a- T' ^' W* [$ _
: c& H4 K) e4 N3 `' P- A
5 @+ g, w* r7 R  \

: y7 c# T/ E8 M/ A1 o+ a# T- }
% r8 D4 J( w$ `" f) {2 f; y7 d8 t. z' g6 p/ h
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-11-17 12:29 , Processed in 0.046408 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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