• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Rate limiting on Ngnix

Html

New Pleskian
How do I use Ngnix rate limits?
Code:
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;
server {
    location /login/ {
        limit_req zone=mylimit;
        proxy_pass http://my_upstream;
    }
}
in the additional Nginx directive of Plesk???
I just tried this...

Server directory is not allowed here...

How should I use this properly?
 
I cant understand, why of a question the user shull open a login form? He was logged in, otherwise he cant write! More interessting is, why a feature, they is written in Nginx documentation in 2017 on page nginx - blog rate-limiting-nginx in plesk in the newest version of plesk in the year 2020 (so 3 years later) not function?
Equal many times plesk offer a high security, but this not given! Today many users have change to newest php versions and to nginx, but nothing is done in punto security in plesk, but nginx can handle many of this features, but they cant set in plesk and btw all scripts for fail2ban and nginx are missing too! So server admins, they change their users from apache to nginx shut of the security, the in apache before exists!
 
There is no build-in functionality in Plesk to limit download speed for website files in Plesk. As a workaround, it can be performed by adding the additional directives for corresponding services. In this instruction download speed will be limited to the 350 Kb/s.

If static files are served by Nginx:

Note: this instruction should be used if Serve static files directly by nginx is enabled, or Proxy mode is disabled in Domains > example.com > Apache & nginx Settings.
  1. Go to Domains > example.com > Apache & nginx Settings.
  2. Add one of the configurations below into the Additional nginx directives field:
    • To limit download speed for the whole website:
      Code:
      limit_rate 350k;
    • To limit download speed for all files in downloads folder and all its subfolders:
      Code:
      location /downloads {
      limit_rate 350k;
      }
  3. Press the OK button to apply changes.
 
The nginx limit_req directive can be included at /etc/nginx/nginx.conf inside http block.


NGINX:
http {
........

    limit_req_zone $binary_remote_addr zone=mylimit:10m rate=10r/s;
..........   
}


Then, the limit_"req zone=mylimit;" can be included in the plesk Additional nginx directives at proper location

NGINX:
    location /login/ {
        limit_req zone=mylimit;
    }
 
Back
Top