exception for NGINX limit_req_zone
Francis Daly
francis at daoine.org
Sun Jul 22 18:35:27 UTC 2012
On Sun, Jul 22, 2012 at 11:05:12PM +0800, fhal wrote:
Hi there,
> Thanks very much for your reply.
> It still doesn't work.
What, precisely, do you mean by "doesn't work"?
Be specific. (Do you mean "this one is being limited and I don't want
it to be", or "that one is not being limited and I do want it to be",
or something different?)
Read my mail again. I included the exact (small) nginx.conf fragment
used. I included the exact test command. I described what I saw. I
described what I expected to see.
Can you do the same, just so that I can make sure that I am repeating
exactly what you did?
> The URL I want to exclude is like
> /forum.php?mod=image&aid=1289568&size=300x300&key=6831686b88a927b0d9646529f88f5052&nocache=yes&type=fixnone
> Does it because there are too many parameters, the map is not working?
It still works for me.
for i in $(seq 4); do
curl -I 'http://127.0.0.1:8000/forum.php?mod=imag&aid=1289568&size=300x300&key=6831686b88a927b0d9646529f88f5052&nocache=yes&type=fixnone'
sleep 1
done
(Note: that has mod=imag, and so *should* be limited)
I see 3x HTTP 200 + 1x HTTP 503
for i in $(seq 4); do
curl -I 'http://127.0.0.1:8000/forum.php?mod=image&aid=1289568&size=300x300&key=6831686b88a927b0d9646529f88f5052&nocache=yes&type=fixnone'
sleep 1
done
(Note: that has mod=image, and so *should not* be limited)
I see 4x HTTP 200.
My nginx.conf http section:
===
http {
map $arg_mod $forum_limit {
default $binary_remote_addr;
image '';
}
limit_req_zone $forum_limit zone=refresh:128m rate=1r/m;
include fastcgi.conf;
server {
location ~*^/(home|forum|portal).php$ {
limit_req zone=refresh burst=2 nodelay;
fastcgi_pass unix:php.sock;
}
}
}
===
f
--
Francis Daly francis at daoine.org
More information about the nginx
mailing list