找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9125|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:
# n( p4 z8 p4 A$ q' Ywget https://www.openssl.org/source/openssl-1.1.0f.tar.gz# |5 x7 b, N  C
tar xvzf openssl-1.1.0f.tar.gz2 A3 O; R3 T% Q9 R: a
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz3 l  A8 E) L; E2 N$ x
tar xvzf pcre-8.41.tar.gz
& W8 @' ^* n: ~
  X& g) O: C+ a: n$ e1 Gwget http://nginx.org/download/nginx-1.13.6.tar.gz- E' T! {" H9 i! K5 v
tart xvzf nginx-1.13.6.tar.gz2 i- \! M# V, C  c0 Q' {+ b7 X

) E4 H+ d; V! o: C2 `, E* P# P7 mwget https://github.com/openresty/sregex/archive/master.zip; c, P, z; A+ F% N' L
mv master.zip replace-filter-nginx-module-master.zip
* ^- p+ T7 h, r0 Aunzip replace-filter-nginx-module-master.zip  ]. Y3 y8 H9 \$ p1 a  d: k

3 _) M5 a: q  b安装sregex* s% a# B( Q" q
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]. H, s( u% W, l% [1 l! {
wget https://github.com/openresty/sregex/archive/master.zip
/ q* d& ~% v" _/ E* m$ i8 H, ~: e$ Cmv master.zip sregex.zip
9 \; T! }9 t- N- S  zunzip sregex.zip9 k  Q7 ]8 u! N. g; c
cd sregex
  t8 H0 J3 L) z; v* q9 r% s1 ^1 [8 `make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整3 E; n1 n% z' w9 ?
ldconfig
" I3 ]" J  J$ ^5 @7 U$ _4 l1 @' |, B. `
安装modsecurity  w8 O4 d1 B. |) Z
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
/ m- w, {' O3 ~! ~$ J& Y# c% pgit clone https://github.com/SpiderLabs/ModSecurity.git mod_security9 M- l$ E7 A! t: s( \7 O
cd mod_security
+ C' h1 Z7 M! {7 F# E. e9 B+ j, Q./autogen.sh  ' N  E$ A. H$ p/ f2 r
./configure --enable-standalone-module
+ M+ y3 I2 m! Y+ x, }, [2 \make
8 X2 U! Q. p4 T+ \& q6 I. i4 H) ]( z8 h( @3 M  [
' J7 H  t' @$ T( Z4 x- c- {5 v$ o
安装nginx$ A; T( J. I/ R. S5 a$ J1 J
cd nginx-1.13.6
8 R7 A' a4 g$ v& l2 c: \. J/ d2 @- i0 s8 Y/ C& Y
[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
5 |0 a, A, T; h# ~3 ]
make2 m1 D; W* Y4 ^9 v
make install1 `* b7 s0 p, _6 P0 @
4 {5 f5 D: O0 }0 p& }5 x
注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module9 b, w" C# e8 z. P2 N

2 \" U" J- j4 ^; Z7 j, Y% ]- w+ Y, q7 [9 k5 _
: r$ X7 b: Z2 q- d% I# g

; m4 w  f+ e  I7 c6 l- o( k2 c! K9 {( b. c9 r, F& k$ w
! P3 z# v. j* k% [5 M
1 e/ `  o8 A2 ~3 ?, Y
- ~$ S$ q5 P6 p

( U+ {7 \, r  v3 I1 L, E
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-11-4 21:14 , Processed in 0.075064 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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