找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11807|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:" \& H9 v* G+ e; [
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz- J! G( T9 T' t9 C- n  |$ p$ a
tar xvzf openssl-1.1.0f.tar.gz1 Z" E/ p+ X, J" W; E7 d
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
+ u  Y3 T# o; V- g: \# htar xvzf pcre-8.41.tar.gz0 H3 H9 C5 f6 m
! w% j, N3 m0 \7 J
wget http://nginx.org/download/nginx-1.13.6.tar.gz9 D- G# Z' u' |- u
tart xvzf nginx-1.13.6.tar.gz
: E+ c2 {2 y# J; |0 W' M1 ^" y# v; Q
wget https://github.com/openresty/sregex/archive/master.zip7 ]2 u. |' E4 f5 v  q! R; `& B! M
mv master.zip replace-filter-nginx-module-master.zip
  h, Q- K* {) V& P. [6 r; {, gunzip replace-filter-nginx-module-master.zip
- [+ ^2 c- C& I% `  \2 h$ a/ U9 r
: N/ M- x7 t' g0 k7 p6 ]4 ]- P0 R安装sregex$ L$ H9 P2 q+ P* ~
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]
) P! P7 A; w, H. Hwget https://github.com/openresty/sregex/archive/master.zip
/ |! i- s' F  R/ [) ~mv master.zip sregex.zip: k7 K! W: T' i
unzip sregex.zip' y# p! v2 u  I: B; K( L
cd sregex
  ~) t% |8 O& x0 Vmake && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整& r& Z/ c- b" N+ {
ldconfig# s' g  q& x$ n  T# N3 {) H1 A6 R
3 M5 V, u9 a5 b3 ]# d' L
安装modsecurity! B6 n- d& D! X/ {1 g  l: \# D/ N2 [
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』$ I# ]. J" Y6 n% S
git clone https://github.com/SpiderLabs/ModSecurity.git mod_security
0 C+ P6 P# T0 p! ?8 ]) k' p# G) ~cd mod_security
" i- b4 [' d8 P2 C3 r./autogen.sh  
: q! w, ]; Z5 m3 w! A$ M7 \3 ]# }./configure --enable-standalone-module  c8 Z+ @! z! c) V5 w# }* f
make: R; N4 H) j1 S$ ^. G2 ?
% P! W9 V* U5 o* z1 l
/ D5 m- {, ]( f# V8 h( c6 K3 s
安装nginx
; {2 _5 E! z6 x" D; g7 Y( p9 pcd nginx-1.13.6
6 w  `3 S3 C( G6 \
! B# X$ N( _/ t( 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 @( X" Q- `( F
make
8 j  l: j7 S( b: Z. |make install
. X1 ?) {# l# W( X0 D1 W8 a" R' N7 P- h' j% G' |4 l" D# {: |
注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module
0 o/ F  G) r( R7 `5 k8 G$ L; Y+ B5 `; ?) z' V* I

9 ^) Q: `/ A; J, V/ e7 k. f: p! ]5 B. n9 a6 w
6 W- w1 V4 r! Y. J

  c: u  l/ a6 H3 _+ q3 K3 k! X7 V0 A! \8 C5 |9 r* `
( k0 N4 d. n7 p* L
" s0 \3 J* T' ~  V: ^

; F4 h' F' `0 [+ k6 o$ P2 @
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-8-30 15:29 , Processed in 0.057563 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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