• 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

Expire Headers in Plesk Nginx & Apache

Yaashul

New Pleskian
I would like to use expire header for images. I know this the code for doing it.

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 7d;
}

Now the question is where shud I put this code.

I can't edit vhost configuration of nginx coz it will remove the following code once nginx updates itself.

Please suggest me the right place to put this code.
 
I just upgraded to Pleask 11.5 and i added the expire cache thanks to the new feature.

To do so:
1. Upgrade to 11.5 if it is not yet done (Upgrade option in tools & settings)
2. click on your website
3. Click on website & domains
4. click on a domain below the 3 buttons (add new domain add new subdomain add new domain)
5. Click on web server setting and scroll down to the bottom of the page
6. Copy and paste & save

Capture d’écran 2013-06-17 à 11.11.37.png
 
Hi,

I noticed that there is one issue with this. If you enable server static files via nginx then these rules won't apply.

They key is adding the try_files directive and making sure you remove the filetypes from the static files list.

I've written a small guide on my Blog.
 
Back
Top