找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 7905|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:0 \6 {. A3 m6 h: c; B
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
+ v* A7 O2 A. t+ P7 ]7 qtar xvzf openssl-1.1.0f.tar.gz
8 Q! ?/ t1 D* o/ F7 A! X# @wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
; R2 V4 b7 V: e# E8 H/ Ftar xvzf pcre-8.41.tar.gz
7 C) @  t) @- F( ]4 A6 E! G
2 x/ r) [. s6 G" {) |& i9 ~) ewget http://nginx.org/download/nginx-1.13.6.tar.gz2 n5 r3 T! u7 t1 a+ N( }
tart xvzf nginx-1.13.6.tar.gz5 n1 K+ I, ?  H) }+ ~# `% \

$ h, l% k; s9 u2 e* Ewget https://github.com/openresty/sregex/archive/master.zip
& r4 B: r, J2 c# E% M( M1 Pmv master.zip replace-filter-nginx-module-master.zip! ^3 _* E- |" }9 n
unzip replace-filter-nginx-module-master.zip3 m, j2 z9 ]9 F

7 k$ T* [# G  H; f# d5 i安装sregex  c5 ^5 _2 B. p: m9 `
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
* J6 ]+ |  {3 [5 K' |/ Wwget https://github.com/openresty/sregex/archive/master.zip2 Q+ G) X/ E; K, n: n- w; }9 P
mv master.zip sregex.zip
$ v: @8 J3 Q" M, W) Cunzip sregex.zip: p/ u4 _( D, h" W
cd sregex
( T& V( e3 y; {) X- S$ [make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
5 B$ S( b( e/ \$ vldconfig
# h9 @5 g) g+ E/ V8 I3 p
8 k2 @8 d' v5 H( X安装modsecurity
6 f5 G; C0 c; Y9 c『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
5 _; [' t, I+ m9 w5 g2 G% C! @git clone https://github.com/SpiderLabs/ModSecurity.git mod_security
1 u: i$ b8 c+ U9 N5 v) |& tcd mod_security2 v7 t9 r3 r7 t5 d6 g; i4 Z
./autogen.sh  
7 g9 x# A2 o- x$ E6 ]# N- D./configure --enable-standalone-module
+ g" M7 s/ S6 J6 Q/ Y* W7 \, _) A/ pmake; E- u, ?9 e- j: \: y

4 {/ [9 e3 D2 h! j" L
0 f, }7 M  @" ]$ z/ c安装nginx: F2 z3 n$ q' s3 _# w& ~
cd nginx-1.13.6
; h. u; V+ v( S' h/ m
& T5 C/ m% n; H" Z" C6 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

- X. Y2 A) a' d5 \2 ]3 \0 ^make. ~3 G2 w- V1 u" s, o5 m3 C
make install
8 n) W9 i. K2 m# f" ]9 j
. w  H+ q5 j+ {, J, t注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module
9 V, _6 ^! l1 s! Z7 @& V3 k8 j- }3 v7 _& ~/ o% l- k& E2 O6 ~0 F5 Q

" y: @7 a; ~+ B" Y, A" Y# n' _* r9 @: n3 k8 g* I: U' i: G$ [; L

* V, j' V, x# V! y. \) `6 w& @; b% C6 X: h- W, G  o6 n5 {6 P

8 U+ w) W% t: z2 c, v9 ^' l; a7 n& s- a- m. g5 t. u

6 P  R/ z  |! l$ v( q4 j7 i$ K/ P9 Z1 ]
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-4-5 00:56 , Processed in 0.078094 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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