找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 8215|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:5 b4 P! ^7 Q: {
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
$ c. T, b- c. ^- a3 G8 ytar xvzf openssl-1.1.0f.tar.gz6 I& p; v# X- Q' w$ _0 w0 T
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz% d% y$ I, V  W% l: z( D
tar xvzf pcre-8.41.tar.gz+ s) c  S3 z3 h: t. k
" m# _. ?* @# `
wget http://nginx.org/download/nginx-1.13.6.tar.gz$ a1 d. `- a/ {: s! Y! W! m* \
tart xvzf nginx-1.13.6.tar.gz
, ^( P# J& E& Q$ W% Y! j' f* S, m8 l( N! Z  u& n9 j6 o0 P' I
wget https://github.com/openresty/sregex/archive/master.zip3 X4 w2 p5 U% ]5 i8 W5 B' k
mv master.zip replace-filter-nginx-module-master.zip
/ U* I7 c2 {  g5 f) o, Dunzip replace-filter-nginx-module-master.zip, c9 t3 w8 }) R- m0 o
$ R3 B. i) G  `
安装sregex
8 F9 m! j, @. ~9 ]6 }/ u[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
; M" `4 P* c$ i3 ?. S4 H, A3 [wget https://github.com/openresty/sregex/archive/master.zip
- |+ ]# j% m  k3 T' hmv master.zip sregex.zip
% i$ m# s( k' a& V- U9 ^1 hunzip sregex.zip- I6 ~7 I' G+ Q) P. u
cd sregex- ?( M- z- i' _/ O6 d8 t
make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整0 l2 D, X6 _& s/ c$ }5 _5 n
ldconfig
, f( W: g6 [4 p0 X. `7 e# V, l9 z3 d5 V8 B
安装modsecurity
, Q: _4 h: Z9 G『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
/ ]1 s" _/ T% agit clone https://github.com/SpiderLabs/ModSecurity.git mod_security& e4 c* b0 A, I+ H* X6 I
cd mod_security
' F  S7 j4 Q8 N0 i1 f./autogen.sh  
+ s! T! v9 H" K1 a; }& M+ ^  X9 b( w./configure --enable-standalone-module) s  R( v" \! F9 o9 e+ h2 P
make
: G% W( T* y* U; E2 G
+ {0 i7 D- t' f" g4 D  P+ z/ q% C* g1 I$ `
安装nginx
4 i9 z, t$ M8 S3 c4 rcd nginx-1.13.6
4 }$ ^' m  z# P. |( a) h& Z
$ S4 ]% }9 H# H6 v/ {0 ]
[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
! q9 }/ j5 N5 i+ v
make# c; b7 M) g5 ^6 t0 C4 ?  I
make install
. z# V  Y* D7 \2 |1 A8 f
% B! g& N* a9 n: a6 T$ }4 v; ~( K7 w注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module; S5 p& I: j+ A# `# |
; j. u4 p  C1 T6 ~
; P8 p6 Q/ X/ h0 ]& `

: s1 m# W% w4 I4 y" V3 j: O
1 b% w* R7 V% B/ K6 g/ a1 j2 T' R6 k/ W- U/ ^
6 X: y. h5 [6 {9 v, }/ ?

  A7 v5 ]6 r# g, c' g4 T& e' N! x5 z8 C% A

) w- h2 a5 z$ g$ T# k& u  H
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-6-7 13:44 , Processed in 0.065868 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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