找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10085|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:/ W4 |: ?' o4 _. a. ?9 Y
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
$ {0 a. h6 L2 H+ Rtar xvzf openssl-1.1.0f.tar.gz7 X+ c9 I6 B; [( q4 B8 z
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz2 O! e7 O% g* r9 a9 _. `
tar xvzf pcre-8.41.tar.gz
% t5 Q  p! E4 {# I4 o5 ^5 U
6 T$ v% y% B/ Fwget http://nginx.org/download/nginx-1.13.6.tar.gz) Z6 z- j9 f% ~- {0 M, H- w5 \
tart xvzf nginx-1.13.6.tar.gz
9 y3 U0 V$ J- a' N: u# O4 F! r
4 f" R, B" E  \  `9 ~) Mwget https://github.com/openresty/sregex/archive/master.zip
$ j" ]) U& x; F  U1 }mv master.zip replace-filter-nginx-module-master.zip4 }) F+ s# S3 v1 I+ S4 K6 j
unzip replace-filter-nginx-module-master.zip
# V7 I1 i* U$ ]" i9 }
2 t; b, {0 U9 Q安装sregex
! D/ F) o3 c" A+ w[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
& Y, Y! r' }5 ^/ F9 Cwget https://github.com/openresty/sregex/archive/master.zip% y6 x- `9 `% v, E( V% y
mv master.zip sregex.zip4 I( J8 W. A0 q% v: d! q+ B1 @# f: e" i
unzip sregex.zip
9 E0 U: g4 R3 T2 o, kcd sregex& d" K# C# G4 I3 Z
make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
7 W- a  `/ F* Z& n% Y4 oldconfig1 v  E1 ^6 Q+ Q# @1 U6 W* u7 n# x. o& Y

, B7 @/ s& d, U( r7 ^" z安装modsecurity
5 J4 u) T( y4 }9 ?% s『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
1 b+ D2 X: B% r0 z6 l+ Xgit clone https://github.com/SpiderLabs/ModSecurity.git mod_security
0 c6 ^# ?( ~, h  {: Vcd mod_security
: {8 k* B% z% ?6 V4 K./autogen.sh  . k/ }1 p8 B5 A& f( E- W% ^
./configure --enable-standalone-module9 B3 H( A; C9 p  u5 [8 v6 D
make
- K0 h- N: a0 H% U, V) E$ m6 X$ T7 }' {1 w

! U# K# M  n5 g% y4 Z: [; S$ A3 w安装nginx
$ ]& I, e  A6 n9 |: G& Hcd nginx-1.13.6
6 u; k8 {, l0 Z# \! i1 d
! D' F/ H* Y) a0 g
[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
8 s; ]' k6 {' G' o7 v6 f7 ~
make
4 F% }$ w: h) [make install
: r+ U' ~2 E, n% a
2 G- n6 A( d/ w注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module6 [8 n2 g/ F& L6 K5 M$ d
' l4 {; O7 Y; _* Q  i0 L0 X

0 f2 B( b9 R% ~  I) u: R2 h
6 i+ l( X1 b. q1 o
* F4 r+ I' D' O0 j& D
# e, Z) a3 l. ?- B3 O" M1 O1 u
% R" j& ^5 b: [1 T7 g# P6 @6 a
; y6 k+ s, p. ^" f# n/ i2 b) x& R: a0 F- b" ^, o
- i$ I) L) z9 ?3 B. ~3 ~
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-3-8 13:25 , Processed in 0.078718 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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