撠潸頛瘥頛擃隡箸剁臭誑閮剖瘥銝雿雿輻刻臭蝙函鞈皞銝嚗靘憒憭折蝺詻蝺餌嚗瘥蝘瘥蝺甈⊥賂隞亙銝頛摨艾
$ Y% ?" P! Z4 S5 H- ?# J* ^' w% d
_, [! v; A; {# I; C憭折蝺亥嗅憭折蝺賂擐閬雿輻 limit_conn_zone 摰蝢拐 key zone 賂- limit_conn_zone $binary_remote_addr zone=addr:10m;
銴鋆賭誨蝣 隤芣:0 S1 ` O5 Z7 \ ~
摰蝢拐 addr zone嚗蝛粹憭批 10MB嚗worker 銵蝔雿輻券 zone 蝵桃曹澈閮園蝛粹靘脣 key 閮詨潦雿輻 $binary_remote_addr 靘雿箏斗瑚皞 IP 靘嚗key嚗嚗雿輻券鈭脖霈訾雿 key 臬箏頝銝祉摮銝脫韏瑚嚗瘥頛蝛粹嚗憒 zone 蝵桃曹澈閮園蝛粹典鈭嚗隡箸典停 503嚗Service Temporarily Unavailable嚗航炊閮胯
x4 l; U5 x( ?3 Q4 Q% o* n. Z5 S; `9 w8 b
3 \6 }, w+ P3 @, O1 Q4 z) Y- [& o亥雿輻 limit_conn 摰銝 IP 臭誑閮梁憭折蝺賂
4 m5 c( m4 Z; f# x, x- location /download/ {
: V4 E; l! `% j" ]" S - limit_conn addr 5;/ F3 i- X$ V' x( Z$ [
- }
銴鋆賭誨蝣 0 v r8 j; C* g) J
* Q' n/ I3 z8 ~- H臬 server 畾菟撠Domain銝撠銝靘桅靘園蝺
J: x6 A. s2 C2 \5 s* @; A& b {- .
2 s6 l' q8 U, G; z( U4 Q6 w m. ? - .
W2 \' T" m( t7 q( ~! y$ h - .
( V l# N Y# t& j' V! x. I - server {1 c( @& f( m3 I
- .
* U4 N6 W& } D% m! n - .7 \! v8 o4 l J* Y# Z+ [
- limit_conn addr 5;5 t' k, t' G) r1 h, O
- .) t8 H2 e8 m# |
- .
8 ^4 d9 }( j |9 P - }
銴鋆賭誨蝣
! A) ~/ _; u4 f I4 }+ h5 K, }3 [" \$ D( x6 _4 r
蝺餌(瘥IP桐蝺)
6 a( }9 u4 e% T5 \/ j. I
* a; n6 U# D- `& D. p
, x) S! k+ v7 N7 t亥園蝺餌嚗擐銋臭璅閬 limit_req_zone 摰蝢 key zone 賂. ~5 f8 B$ V+ @5 i
- limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
銴鋆賭誨蝣 & j: k& j F* J: h) t$ C4 y! n8 S
支摰蝢 zone 蝔梯憭批銋憭嚗銝鈭銝 rate 摰蝺餌銝嚗桐臭誑雿輻冽蝘蝺甈⊥賂r/s嚗舀蝺甈⊥賂r/m嚗嚗r盍equest嚗靘憒亥摰瘥銝航 30 甈⊿蝺嚗閮剖 30r/m2 d; X9 j; e3 X
! [# `7 S& G/ W6 ~% X/ m
2 t. r B3 r* W" K嗅券閬園蝺餌唳孵銝 limit_req 閮剖嚗# E1 {$ J$ K+ ]
- location /download/ {! d& Z- ]* R0 y
- limit_req zone=one burst=5;, |& c! D! \; Q+ n& H# ~% @
- }
銴鋆賭誨蝣
1 l: z* w' \- D1 r臬 server 畾菟撠Domain銝撠銝靘桅靘園餌
% ?$ s! ?( L4 X# }, e- .
5 S+ e( X+ z- m- K; W+ Y' m* Y - .
7 L( x. g. O+ S! E - .
) s9 Q f- `, D5 X [8 c) o) n - server {
, ]4 i& o: |: Y3 `% [- z - .+ Y- D8 i3 P2 J2 c
- . x! ~( ?7 ^- n9 H( T0 ^2 O! g2 W
- <span style="font-family: Tahoma;">limit_req zone=one burst=5;</span>
& v/ N/ u) w, Y' x - .
6 G" U1 Y- X; j Q - .
: J. Y6 q4 [% x1 I& ] - }
銴鋆賭誨蝣
$ i% U6 t2 t. P3 y# I1 ?% T: W" I# g3 n* \! n! B" x
蝯隢:
2 I0 O" ~7 w$ P) |$ d! I6 t8 |* T7 k4 z" n. b" G3 `
撠潔誑銝閮剖臭誑脫迫擏剖恥餅隞亙鈭敹銋敺閰血瘨雿∠餃祝
' C: r9 U% a/ Q- Z' u% e$ H* O" v& Q
嗡隢 :
* W# `, U. |' i* y$ a! }https://blog.gtwang.org/linux/ng ... address-tutorial/2/
0 C; C' v- Q# Z! K2 ~http://www.nginx.cn/446.html: z n' y- T7 ? C7 O0 m
& h/ L, T3 u. }7 S7 S2 [
|
|