找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 11476|回复: 0

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

[复制链接]
发表于 2017-10-19 13:50:40 | 显示全部楼层 |阅读模式
准备文件:: j6 o" a- f  H/ h7 O
wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz
1 a$ ~( H3 B* N4 E) |" Ptar xvzf openssl-1.1.0f.tar.gz. v+ m4 m, ~% K2 t  {0 O) N
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.41.tar.gz6 Q: e" z, C6 [0 |( M' p- y+ P' B7 f
tar xvzf pcre-8.41.tar.gz
9 t( r8 J' n! s( J' {
( r( x# I9 K8 g8 J" j/ _/ f3 Iwget http://nginx.org/download/nginx-1.13.6.tar.gz
. O: }' w1 _/ k: w0 Ttart xvzf nginx-1.13.6.tar.gz; q6 V1 \  }; ?2 Z/ Y

7 [1 t7 ~2 h1 X: X& A' nwget https://github.com/openresty/sregex/archive/master.zip7 o3 Z- N( ~) Y/ \
mv master.zip replace-filter-nginx-module-master.zip
( j* w- }0 d; y* R! `unzip replace-filter-nginx-module-master.zip
8 Y, k5 E& ^5 X
% s4 U/ k* c9 `& m2 w% q& {安装sregex
, h! W& l" n' P- h) H- ~[replace-filter-nginx-module-master关键词替换模块需要这个东西,如果不喜欢可以用ngx_http_substitutions_filter_module这个关键字替换模块]! o, x  |. e: B4 F, y
wget https://github.com/openresty/sregex/archive/master.zip+ h  X# |! {! f. L+ v0 K  `! O4 a
mv master.zip sregex.zip( l! p& b+ j/ `
unzip sregex.zip! N. L" L) w7 V/ h2 C
cd sregex
+ P% A6 J8 h# p1 xmake && make installln -s /usr/lib/libsregex.so.0  /usr/local/lib/libsregex.so.0.0.1 #按实际情况调整6 |6 Y1 c( x( }8 K
ldconfig5 b( M1 J/ ]$ e9 U

% p. P* E% N1 D6 y# g安装modsecurity
, m8 Q  o# y7 l0 N8 w- {. W『依赖的包:pcre httpd-devel libxml2 apr 视情况安装。yum install httpd-devel apr apr-util-devel apr-devel  pcre pcre-devel  libxml2 libxml2-devel)』
, Z( S# {4 n: a: y  H1 Z" G, g. n0 igit clone https://github.com/SpiderLabs/ModSecurity.git mod_security: j9 b" k) n+ E* ~# R6 e, \) y) ?1 O
cd mod_security) l6 _" J( f; O0 s% n$ i! d0 `
./autogen.sh  5 M, o; x; d( c
./configure --enable-standalone-module
9 C6 e  v, b' bmake$ Z9 B) J: {! G* m- `- F: p7 w

! _( `# Q: J" w$ {/ V
6 C( I1 w/ G4 ]2 u+ l& }' N4 u2 {% C安装nginx
4 p) ~' x+ C3 l. }+ M/ E1 ?% Wcd nginx-1.13.6
8 M* `9 ~' [! Z: W1 n
" k' C4 R: G' w' [  Z
[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
4 K6 \  n4 c" t' s9 A* y
make
' E0 Z8 F( Z* M+ O6 o; o; H% h' z- Bmake install8 ]5 X9 P6 g  T$ [: v" J
) L' \; x1 c' W5 d. b
注:--with-ipv6 已经被移除默认支持ipv6,   --with-http_spdy 已经被移除合并到--with-http_v2_module' e  Z1 F% p: K

: L/ g6 {  |+ z, b! D+ o6 C1 z- _, [2 v/ ^) j: ^( z( @
3 g" |7 w5 t" o3 Q; o
' |- Q. ~. r5 L: k* O# K% d' [
$ b  C+ Y9 r9 i! }, p' e7 \
7 h& R  d  w! A# Y2 t! F
" e3 B. e; B+ c; \  z, W

, Y7 c4 l8 [  P0 z7 M/ N2 |' h) s5 o7 j' f  }
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-7-26 17:40 , Processed in 0.077366 second(s), 20 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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