Introduction
Some users may want to exclude certain files or folders from being cached. This article provides the procedure to create an include file in which the exclusion configuration must be placed.
Procedure
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Create the include file for the domain.
touch /etc/nginx/conf.d/users/$cpuser/$domain.tld/include.conf
Please note that "$cpuser" and "domain.tld" must be replaced with the cPanel user's username and the site's domain name, respectively. - Open the newly created include file in your preferred text editor.
- Add the appropriate configuration for the files to exclude.
location ~ .*path/to/file/.*jpg$ { expires -1; add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; }
Please note that in the above example,jpg
files in thepath/to/file/
folder relative to the document root will be excluded from caching. - Save the changes and exit the text editor.
- Rebuild the Nginx configuration for the cPanel user.
/usr/local/cpanel/scripts/ea-nginx config $cpuser
Please note that "$cpuser" must be replaced with the cPanel user's username.
Comments
0 comments
Article is closed for comments.