I cannot setup req_limit_zone
for specific file inside location
since, as I figured it out, the main location
catches the request and it never comes to the targeted file.
Configuration inside nginx looks like this
location / {
try_files $uri $uri/ /index.php?=$uri&$args;
}
location /wordpress/ {
try_files $uri $uri/ /wordpress/index.php?$args;
}
location /wordpress/xmlrpc.php$ {
limit_req zone=mylimit;
}
The goal is to setup limit_req_zone
on xmlrpc.php
file so I can create fail2ban rules to ban people who try to send POST requests.