• We value your experience with Plesk during 2025
    Plesk strives to perform even better in 2026. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2025.
    Please take this short survey:

    https://survey.webpros.com/
  • On Plesk for Linux mod_status is disabled on upgrades to improve Apache security.
    This is a one-time operation that occurs during an upgrade. You can manually enable mod_status later if needed.

Question Nginx server-wide location directives without using "Additional nginx directives "

pleskpanel

Regular Pleskian
Server operating system version
Almalinux 9
Plesk version and microupdate number
All
We currently use the "Additional nginx directives" screen to implement Nginx directives for file locations, specifically rate limiting.

It would be much preferable to do this globally however is there a way to get this to work in the main nginx.conf without specifying a server_name for each site?
 
How do you apply the rate limit?

As far as I know, you need the limit zone declared globally and the actual limit triggered in the server/location block.
 
Precisely but the rate limit application on any location have to be added using the "Additional nginx directives" screen versus a global block. Ideally it would be great to be able to make this server-wide or global in the nginx.conf or a sub-directory of the .conf files since the "Additional nginx directives" don't get updated after initial subscription creation.
 
Module ngx_http_limit_req_module indicates limit_req can be set in ``http, server, location``.

/etc/nginx/conf.d/*conf get included in the http block.

You should be able to declare the zone and set the limit in /etc/nginx/conf.d/limit.conf

These directives are inherited from the previous configuration levelif and only if there are no limit_req directivesdefined on the current level.
The following applies the limit to all hosted websites and with these values, there is a noticeable increase in the website load time. 17+s as opposed to 1.69s for a plain WordPress website.
Code:
# cat /etc/nginx/conf.d/limit.conf
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

limit_req zone=one burst=15;

In order to apply the limit in the server block, you can use additional Nginx directives or a custom Plesk extension to make use of the pm_Hook_WebServer

I'm not aware of any option to add custom rules in the location blocks, without using custom templates (don't recommend).
 
Back
Top