找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 8747|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:: }' O8 H+ t% L4 \* e
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz8 |' i) F( G: z: b6 D$ I. \% C
tar xvzf openssl-1.1.0f.tar.gz
% {2 \% H3 c& _5 _9 z$ Q8 e/ u6 {wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz
2 u- w0 Q% j6 p7 }# s' utar xvzf pcre-8.41.tar.gz
  ?# _+ C& o: m4 u
0 s$ }) a" ?5 y# `) cwget http://nginx.org/download/nginx-1.13.6.tar.gz
1 r  s" x+ Q! v4 l6 g- btart xvzf nginx-1.13.6.tar.gz
9 P2 }: u6 Z; g$ Y  Z7 T
* k/ M( g/ N; e: Pwget https://github.com/openresty/sregex/archive/master.zip
9 U+ n$ ]/ O- c7 kmv master.zip replace-filter-nginx-module-master.zip
$ _: K. N- p1 y- zunzip replace-filter-nginx-module-master.zip
+ f+ P- [$ Z! H/ X! }4 g/ \7 ^: M2 h1 U$ u: W3 ~
安装sregex
0 {5 K% |) K, v[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]; ^4 m  y; H  _1 G8 d0 g5 T3 y
wget https://github.com/openresty/sregex/archive/master.zip
& W( }& ]; k  ^: K( ?mv master.zip sregex.zip4 V5 ~6 L8 P& ?0 w
unzip sregex.zip
1 \" o( C2 n! g6 o+ y4 zcd sregex8 G% ?6 o, [' L) ^! Y0 \
make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
5 k. _5 x9 n2 A0 d# Q4 q, vldconfig
5 s. `; ?* g' ^! g0 X2 m' [9 M* a" \3 ^: E
安装modsecurity
! N0 t8 [! l& E3 _! F6 q9 X0 @7 }『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
( d+ h( `6 u% O9 ggit clone https://github.com/SpiderLabs/ModSecurity.git mod_security
) r" M8 k$ r; q; p& P. L  S& }/ o" `cd mod_security' K- M+ [( _, a+ M3 F7 _
./autogen.sh  
; l9 G9 Q' L4 X; S./configure --enable-standalone-module: x$ y9 t2 s. k; P% E4 {) G2 a4 @+ P  a% r
make
4 z5 R+ ~  O2 g
" h  H/ |! F6 B4 l6 }  V1 P) {
1 S% O4 ?$ j5 e* x: ]安装nginx
% n/ `, ]3 z) o$ F9 v4 k6 gcd nginx-1.13.6' v% t% @" d" @
, o$ [( R, y' g  _, D* ]
[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
' E* F8 V2 Q# n4 B, q
make5 l% @: o% Y1 I0 i6 H
make install
3 i% W1 l) q. o/ D, ^3 M6 {/ {& p. e2 W/ o3 _4 \4 w  `% d1 a. ?
注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module
# \% T. Y# {6 I/ {  [- t' c2 G/ H# J; |
4 f' d  @9 h+ U
# Y8 U& k$ i; k& `( A! v: `9 T
/ N: ]5 r6 d1 K1 [
; C+ }9 ]1 j, x! s+ o1 b( x* y
( r. Z8 t0 e& Q; B/ p
9 U( z+ P. v5 w) t- |3 p% z
1 A1 Q8 R& x9 K8 f6 I  x
; L0 |3 S+ n5 q
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2025-9-10 06:04 , Processed in 0.056375 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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