找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11261|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:3 B* W/ R) N7 G8 s9 n
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz" G1 x  q8 `+ U# \3 P2 a
tar xvzf openssl-1.1.0f.tar.gz
& \, u: Q) {$ \) t& a1 ?1 `9 Gwget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz9 i7 W! O6 u0 S3 ]$ z# q. d5 U: \# |9 \
tar xvzf pcre-8.41.tar.gz
2 [, `) h9 x' U% D  U$ A, `4 e$ D, [3 J
wget http://nginx.org/download/nginx-1.13.6.tar.gz
1 R! D: j* c, S+ ~6 H7 `tart xvzf nginx-1.13.6.tar.gz
  p! |9 J' ~! B& o3 F) t+ r3 O- b1 F# F- K
wget https://github.com/openresty/sregex/archive/master.zip* @% c* C% ]3 I/ I; U. f7 y
mv master.zip replace-filter-nginx-module-master.zip! {( D) x8 E5 x
unzip replace-filter-nginx-module-master.zip/ |# G! R" K, `! F$ _- k$ l

5 T  z; z" U/ Y2 m* s+ a安装sregex
" _* c  j9 j- s& ][replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]# I9 t5 z+ V: I1 D$ R5 n
wget https://github.com/openresty/sregex/archive/master.zip
/ D6 I3 f6 a$ U" L" c! rmv master.zip sregex.zip$ e4 u3 t  W! r( e& Q; y" @4 ]
unzip sregex.zip
+ o  _4 V& {9 e; K& _! O: kcd sregex: c" K5 `6 V. `' Y1 o3 v
make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整1 d& V! n8 D9 x. N
ldconfig- b, D. O- H" f
( N  h: x+ f1 \
安装modsecurity; z9 u+ k# h. L6 I
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
9 w, L5 A1 b4 D6 tgit clone https://github.com/SpiderLabs/ModSecurity.git mod_security" B7 _' q# N  D; q
cd mod_security( J: t2 @8 }( i  G# J
./autogen.sh  
( _3 l  q! X9 a' v, I3 t./configure --enable-standalone-module4 G+ ~3 L- M, \
make; Z) S' k& Z# V/ i' \4 `: c
" T" v, N1 ]2 N* @. o9 ~' S* K# O
1 O( j  C  W- ]0 g' J1 ?0 ?+ n
安装nginx
( D# H/ ~9 o* ^cd nginx-1.13.6, m, x9 T7 g4 t' y2 P' m9 O
/ v0 r' I: S  E
[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
4 l. k3 r0 F$ H3 S- P/ a# f( C
make0 C. z, q) G2 b5 F
make install
/ B" i% @; t1 k
5 @! i: i) K  X9 q4 `注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module; g  e" O* x2 f5 b; V

8 |% `+ i6 @! R+ R9 l& H) A1 u. H( k, M' [+ W3 K& K& ~5 g
/ p4 K" D' m% u3 C7 O

5 D+ Y9 K0 e8 l4 i5 Z6 k7 G  z  R2 j2 k6 `1 L
: k3 {& I& M* ~% w0 I; c

3 o: `- O3 W  g: A, S% ^; s) t0 M9 a

& }- f9 D6 g: m+ R' ?1 ^  G
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-7-1 04:22 , Processed in 0.109161 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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