• 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

Resolved How to change NGINX Cache parameters in a Plesk web server

Paulo_o

New Pleskian
Server operating system version
Ubuntu 18.04.6 LTS
Plesk version and microupdate number
Plesk Obsidian 18.0.52 (upgrade #3)
I need to change the "inactive" parameter in a line similar to: proxy_cache_path /data/nginx/cache keys_zone=my_zone:10m inactive=5m;

Plesk does not accept this as "Additional nginx directives" with the error "[emerg] "proxy_cache_path" directive is not allowed here ".

Checking the domain file configuration I see something like:


#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
proxy_cache_path /var/cache/nginx/domain.com_proxy levels=1:2 keys_zone=domain.com_proxy:5m max_size=134217728;

fastcgi_cache_path /var/cache/nginx/domain.com_fastcgi levels=1:2 keys_zone=domain.com_fastcgi:5m max_size=134217728;

So, I can't change at the "Additional nginx directives" neither the domain file and the directive "inactive" does not exist.
Also I have created a new file in /etc/nginx/conf.d with the configuration, but the command sudo nginx -t fails because there is already a "proxy_cache_path" defined at this domain file.
Anyone knows where "proxy_cache_path" can be changed? (or any other NGINX configuration, if not possible on the Plesk "Additional nginx directives")

Thank you.
 
Hi Peter,

First of all we need to understand the current defaul value for "inactive". It seems less than 30 minutes but we do not know for sure. We intend to make some tuning related to "proxy_cache_valid" (this one we can change in plesk option or at additional directives) and "inactive".

Thanks kpushkarev, will ckeck templates in further detail, but it seems Plesk is not very user friendly to optimize nginx in some cases.
 
Anyone knows the plesk default value for NGINX CACHE "Inactive?
And how to change it?
As far as I can tell Plesk doesn't specify a value for the "inactive" parameter. So it likely defaults to 10 minutes (the Nginx default).

If you like to use another value you'll have to create your own custom Nginx template, as @kpushkarev pointed out. You can find the default template used for the Nginx Cache Path configuration at /usr/local/psa/admin/conf/templates/default/domain/services/.
 
Last edited:
Back
Top