找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11116|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:% V1 U  T' _# Z- G- w, ~' L! C4 A
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz; z: C3 T7 l* }
tar xvzf openssl-1.1.0f.tar.gz3 u) _3 P( l; `! }! {& {/ g
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz$ K, }& C" z) R$ v/ B1 \
tar xvzf pcre-8.41.tar.gz& E- p: w/ I/ T

- B/ J; d8 u  Owget http://nginx.org/download/nginx-1.13.6.tar.gz
( `4 J. p! r3 Atart xvzf nginx-1.13.6.tar.gz
& j# {9 Q: @( U0 n3 ^) i
$ y) A* {1 ^# v) }- h8 U0 @/ ~wget https://github.com/openresty/sregex/archive/master.zip$ _( @. D  @( l' e4 {8 o: s
mv master.zip replace-filter-nginx-module-master.zip0 C9 ]+ E+ q8 Y% X
unzip replace-filter-nginx-module-master.zip
1 t  w4 u5 ]4 P1 [0 d8 S6 [
! u9 ]0 n+ j; W" A安装sregex9 ?- X! K' y9 Z3 i% j
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]; `" k' _, m: K$ R' B" L; T
wget https://github.com/openresty/sregex/archive/master.zip  s, ]& J  t" `4 D# [
mv master.zip sregex.zip
: K$ J5 a! I# f1 `& F0 Ounzip sregex.zip; |% M' {1 r7 C0 M
cd sregex2 g- i# [# ?# o+ ^. e
make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
. W) e: ~* f. }6 ildconfig
* S% y+ a7 f  c
7 Z5 j7 w9 o) y/ ^" d& m) v安装modsecurity
1 U* A+ W. c/ U4 N9 `- F『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
4 T/ m/ n" z  E& C  [7 d0 C0 \" ogit clone https://github.com/SpiderLabs/ModSecurity.git mod_security/ r$ ?2 o! `' v
cd mod_security1 Y% m1 {- m# B7 @2 [
./autogen.sh  
; T' l  i" m9 [" d1 y  N./configure --enable-standalone-module
3 n# Z! z+ S9 a" v3 _( G4 kmake9 j9 [- A! f/ ]9 b

4 W7 L, L0 J* `7 U
4 E' t! k& ?  M# m安装nginx3 o# {8 o: H# a1 O5 ~
cd nginx-1.13.6
& c+ y: V+ V3 D. b
0 U/ l" c, I( i: y% Q0 ?
[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
) J; x$ C1 N$ V
make
! t8 f: n& v- ^2 \1 _' [. Nmake install- ?/ c0 |5 V+ Z$ D

* a4 k  a/ C0 r$ U注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module
0 [6 ^* N# q! V8 F; i% ?! K( c
2 \; ]0 @9 k  C# v
) s* M) K7 T1 m  B. t2 ?5 J
+ t# P' p' y) A% U8 y% J+ n8 S/ f* j% W3 n. o# r" w4 ^8 f0 `1 H9 C* ^

6 X9 ^3 J7 F0 `
6 M$ C+ Z( f9 u8 U! |) ^+ F0 R( }

* k+ j3 U% G4 Y2 C
0 c" g, K4 h1 D: s$ S% h
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-6-16 09:39 , Processed in 0.071647 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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