找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10270|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:
. o7 X6 J! P. X& s5 kwget https://www.openssl.org/source/openssl-1.1.0f.tar.gz3 C/ m* p6 p" f# ?6 M
tar xvzf openssl-1.1.0f.tar.gz
& W; s7 V$ U1 Y8 Qwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
) e* i1 t4 R; Qtar xvzf pcre-8.41.tar.gz
) P4 ~. k- ?7 h2 q/ U; @: p1 |9 D5 ?9 P1 R
wget http://nginx.org/download/nginx-1.13.6.tar.gz
0 w1 k. ^) A( T6 H* C7 Y- q8 ctart xvzf nginx-1.13.6.tar.gz
: l/ B' i3 p( i1 o
, F, }4 q" B5 d; y0 t8 Jwget https://github.com/openresty/sregex/archive/master.zip
- X3 W" T8 n: Y5 vmv master.zip replace-filter-nginx-module-master.zip
- D: d( g. |* D" \3 J$ l+ yunzip replace-filter-nginx-module-master.zip
6 f, ^( n! F! }: _) F; ]& G. E8 b: Q0 X& I( ]
安装sregex
& \' f" m( ^. E' T# v5 l[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
( B" x9 ?9 d+ o! C" m/ Q% qwget https://github.com/openresty/sregex/archive/master.zip
/ A- G5 `( w1 \mv master.zip sregex.zip
1 n* G3 l# F; F4 S, junzip sregex.zip) @$ o# f. [) e
cd sregex
. E* \7 h% O* h" [7 Umake && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整% ]) n/ j, G' `; s" e! W) `
ldconfig
1 X5 v. R' o) q1 A+ Y% ]
& z  z/ v/ S6 q安装modsecurity, R/ G( ]7 @0 D( d; s- s
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
+ d* B/ a! a* ^git clone https://github.com/SpiderLabs/ModSecurity.git mod_security
% }' R* a8 h" i$ t( t; S: b5 Fcd mod_security' p( y4 \3 G1 r& f- S6 E
./autogen.sh  
% H7 ^& M% Q+ b! o3 P./configure --enable-standalone-module
4 }. Z! l2 \% O; g' Q: r& O" \make
+ E6 M2 _7 A' w5 F* o. m
* t5 u9 _/ i- y  z/ i. a$ }# F1 {0 U& z3 t- X( P4 O
安装nginx! [# [! n- i: L# V7 X/ ]+ z
cd nginx-1.13.6
. x# Y" G- j/ d) e7 K; y- O4 w2 A5 q" c' V
[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
( `0 \* g- L4 N$ S5 m
make/ @2 T$ l2 {6 w1 ?' J
make install5 w9 Z) Z- B- j2 d' W

! w. C1 w$ X. r$ V/ H注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module* q9 T( v4 ^+ Y8 ?( y9 J
! j5 K1 m9 P8 `) D) E

% S% y# W) @. q6 I5 o7 I1 D# o% z4 A) f( t$ c; p* ^
* e& Y1 T$ j% C6 {. {, y7 [( J
- K4 Q/ e0 }$ b! q

3 m8 [# g, X( k" p: Y
2 j/ w. P! g. J- Y; \: B, P' {2 G, L

/ L9 E% N% Z! n3 g. {4 \# x$ o2 @4 }
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-3-26 04:50 , Processed in 0.060256 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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