速率限制器不适用于索引页面?
Rate Limiter not working for index page?
我将此位置块与 php
一起使用
location ~ \.php$ {
try_files $uri =404;
limit_req zone=limit burst=3 nodelay;
fastcgi_pass php_farm;
include nginx.fastcgi.conf;
}
如果我转到 localhost/testxxx.php 并开始 F5 垃圾邮件,limit_req 将正常工作。 但是,如果我只是转到本地主机并启动 refreshing/f5,什么也没有发生,它也不会激活 limit_req,知道吗?它似乎没有捕捉到我的主 index.php 文件,因为它没有显示在 URL 中? (localhost) 没有尾部斜杠?知道如何在位置块内捕获 index.php 吗?
是的!在查看这篇很棒的文章后,我终于找到了解决方法:
https://www.digitalocean.com/community/tutorials/understanding-nginx-server-and-location-block-selection-algorithms
我在我的位置块下面添加了这个:
location = / {
limit_req zone=limit burst=3 nodelay;
}
它捕获了 'localhost' url!
我将此位置块与 php
一起使用location ~ \.php$ {
try_files $uri =404;
limit_req zone=limit burst=3 nodelay;
fastcgi_pass php_farm;
include nginx.fastcgi.conf;
}
如果我转到 localhost/testxxx.php 并开始 F5 垃圾邮件,limit_req 将正常工作。 但是,如果我只是转到本地主机并启动 refreshing/f5,什么也没有发生,它也不会激活 limit_req,知道吗?它似乎没有捕捉到我的主 index.php 文件,因为它没有显示在 URL 中? (localhost) 没有尾部斜杠?知道如何在位置块内捕获 index.php 吗?
是的!在查看这篇很棒的文章后,我终于找到了解决方法: https://www.digitalocean.com/community/tutorials/understanding-nginx-server-and-location-block-selection-algorithms
我在我的位置块下面添加了这个:
location = / {
limit_req zone=limit burst=3 nodelay;
}
它捕获了 'localhost' url!