找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11994|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:
! b: i. s0 w5 c$ ~6 y& k7 r5 \wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
- Y) K' O, F) b, O4 E( }; ttar xvzf openssl-1.1.0f.tar.gz9 b7 P7 i0 \% g, ]* Z
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
- [' w! `1 S& Q# t, _tar xvzf pcre-8.41.tar.gz2 I5 s1 }7 L1 c: Y- r

1 {' Z& C! R0 m2 lwget http://nginx.org/download/nginx-1.13.6.tar.gz8 |# v4 V- c) o9 s# _: o, o
tart xvzf nginx-1.13.6.tar.gz' J  C  m1 _- a. w" j

* U( o) w  L8 {$ @wget https://github.com/openresty/sregex/archive/master.zip
" ^0 t+ h! K2 I# H, Bmv master.zip replace-filter-nginx-module-master.zip
9 ~& G, x: i0 {9 q, k0 k9 ]unzip replace-filter-nginx-module-master.zip- h4 S; n& E! S( I( t
0 r. ^7 E0 Z+ W) Q
安装sregex9 s: v. s3 l5 V
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]3 g) P/ ]) s8 G3 u0 ^, X9 p
wget https://github.com/openresty/sregex/archive/master.zip7 @4 s( d4 n* n' n
mv master.zip sregex.zip+ A  y9 P" a7 M/ X" Q
unzip sregex.zip
& D4 T0 {- Z# x: e$ Ycd sregex6 q& ^$ J2 D* h3 f6 J' i* ^
make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
; ]  B/ p6 |0 F. R3 |6 wldconfig
5 o% y8 E0 O$ e5 J
4 C' O' h9 \6 Q+ _+ U) I3 W安装modsecurity" \# h- @0 g6 c2 @( |
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
! H4 X9 Y3 C9 [' B& ~7 F& Ugit clone https://github.com/SpiderLabs/ModSecurity.git mod_security
" _- Q5 ^$ S8 C' ?- x4 g9 }' `cd mod_security! c8 a, U! Q% k3 z, l6 l. `
./autogen.sh  
" h' q) Y( r9 g- N8 O./configure --enable-standalone-module$ R* m! ~' c3 @* h3 C/ [
make6 g% z4 d$ E6 k- B2 T6 h8 Z: {, B4 g

9 I( c% F' _4 `. a3 X7 W! |# x+ ?* [$ ]0 \& D
安装nginx
7 a* r" g$ K( k5 ~$ n6 bcd nginx-1.13.6# W9 Q" M; p* ]

+ C2 H5 P  S( c3 f* i5 {
[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 h+ K/ ]& i& l) [8 U! x5 y# P/ pmake& }& O7 n5 k( [, Z6 t. C0 @
make install
0 A! `- ?8 \* {  U0 t3 n; ?% G9 ]- L' Y1 c. d; @
注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module2 k6 o+ O- a! F8 b

) u* X: U- `; M3 \* ?8 t! \# M3 z; P  {, ]1 \4 ?7 {  Q" q+ q$ c

$ W3 x. _' }! D. C' {: b+ J( V4 x- Y5 L" Z- n& ?5 r

' |+ T- C, @0 e% S! u- X2 t; \' Y4 ^# ^. q1 I4 ~

. }& e5 |2 ]6 K! _
, B3 M/ ^6 F. @. I' h
; b% F( L, r0 B- R" |* R7 t
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-9-20 02:51 , Processed in 0.073671 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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