Welcome! Log In Create A New Profile

Advanced

Rate Limiter not working for index.php

Posted by Dillybob 
Rate Limiter not working for index.php
April 29, 2015 01:30AM
I am using this location block with php

location ~ \.php$ {
try_files $uri =404;
limit_req zone=limit burst=3 nodelay;
fastcgi_pass php_farm;
include nginx.fastcgi.conf;

}

If I go to localhost/testxxx.php and start F5 spamming, it will work. **BUT**, if I just go to localhost and start refreshing/f5, nothing happens and it doesn't activate the limit_req, any idea? It seems like it's not catching my main index.php file because it's not shown in the URL? (localhost) with no trailing slash? Any idea how catch index.php inside the location?



Edited 4 time(s). Last edit at 04/29/2015 01:39AM by Dillybob.
Re: Rate Limiter not working for index.php
April 29, 2015 02:25PM
Yes! I finally found a fix after reviewing this awesome article:
https://www.digitalocean.com/community/tutorials/understanding-nginx-server-and-location-block-selection-algorithms

I added this below my location block:

location = / {
limit_req zone=limit burst=3 nodelay;
}

And it catches the 'localhost' url!


Mods may close this!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready