找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 5820|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:
. @, _# _; j- ~, Zwget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
# T+ A$ R* D! T) ], s) ]0 t* B7 Wtar xvzf openssl-1.1.0f.tar.gz: z  u% Q+ C5 R
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz1 j/ Y+ c; y3 N" O0 h) k
tar xvzf pcre-8.41.tar.gz
8 h% N7 k, Q- ?) l3 b
7 a" I0 R% M: R5 ]& M$ r1 Bwget http://nginx.org/download/nginx-1.13.6.tar.gz/ G0 Q& _* b$ W6 q9 @. H
tart xvzf nginx-1.13.6.tar.gz/ B( Z1 \7 s& c4 ~% e

! H: h9 V/ V) m& W; ewget https://github.com/openresty/sregex/archive/master.zip6 m& \" J/ @  s' \; F/ v( e7 V
mv master.zip replace-filter-nginx-module-master.zip* d2 H' \0 k1 o
unzip replace-filter-nginx-module-master.zip
# N0 h) a5 h- V/ L; c( {4 M0 s9 o9 D! x: z% R! w
安装sregex% N* R6 ]( K- V
[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]6 L. l3 M8 \0 ^' w5 j# e' Z
wget https://github.com/openresty/sregex/archive/master.zip
7 G6 p0 Y& Z; }5 i0 Umv master.zip sregex.zip3 f$ j# v2 M9 W- j# `" u  {
unzip sregex.zip7 a# H1 n1 @- l* b  Y
cd sregex5 P5 }. ?5 U' u& A- d$ _' J
make && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整
' r9 I- A/ {  R8 rldconfig
4 M2 t* w8 H0 B  T9 Y1 ]" r! Y# x, u# X; t  u) N
安装modsecurity% w9 E, ?& z5 ^
『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
7 M' ]. k# O7 Kgit clone https://github.com/SpiderLabs/ModSecurity.git mod_security
6 A$ `1 C& K' ucd mod_security
8 T- S' ~- b: D8 E; j- z./autogen.sh  % t9 a/ F( T! b7 e; C  g( V
./configure --enable-standalone-module
! {7 ^1 Q$ W& G, s' |# F& ?make
- ^1 Z( i2 K4 C  `2 g5 u7 f( V( v6 ~0 Y; F

5 ]& A& k3 V! J( J安装nginx
, }  ^. h' l: n4 bcd nginx-1.13.69 O% W! z$ s' z1 p( a5 F

. ?7 a! ]: @! x
[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, G+ Z+ x. H" H2 \- g: ~
make$ c& \$ U, _& g# ]- `. z3 d
make install, z/ C7 c8 m; m  ?# Y, M
5 `. ?) F" e5 k1 z8 O
注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module
# H& C! v  O2 b9 u' [  T/ ]. B- u& `& j

; m! w5 P6 B( ^! p  S
1 k3 f' }3 f% E0 c
3 K8 p' ^6 Y: w3 d2 U/ n' u. n8 P5 p5 r4 N, A* s! ?  U

+ a; b* |# x0 B6 F7 R, c/ K1 f; ~, E$ T
( |  \' L1 x+ J7 _3 \/ K
5 H2 r# _( b( \
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-9-8 08:53 , Processed in 0.070716 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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