Welcome! Log In Create A New Profile

Advanced

Just moved from Apache and having a small problem with leverage browser caching (a bug in current release?)

Posted by benqzq 
I'm using a minimal Ubuntu 16.04 and I moved Apache to Nginx 2 days ago. I run a minimal Wordpress site (4 plugins, no customization).

I’m sorry if it’s out of the scope, I'm not sure if it's a bug in the current release and suggesting this with much caution. Please give me a graceful insight over this because this is quite surprising and frustrating in these 2 days.

------------------------------------------------------------

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

location ~* \.(pdf)$ {
expires 30d;
}

------------------------------------------------------------

I’ve pasted the above code inside the server block in the default.conf file of Nginx. I then executed systemctl restart nginx.service.

Yet when running GPI test I still get “Leverage browser caching” for many jpg files but “jpg” is already included in the directive.

I thought it WordPress (Autoptimize) related but it doesn’t seem so as Autoptimize doesn’t deal with images.

All documentation I found, so far, deals with what I already tried. Any ideas? Maybe most doc is outdated? Maybe that’s a bug in the current release of Nginx?

Site URL in GPI test: https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fcontfix.co.il%2F



Edited 1 time(s). Last edit at 08/13/2017 03:36PM by benqzq.
This is my default.conf:

https://gist.github.com/Benqzq/16bcb83d29c6225be0e38e631f92de1f
Solution here:

https://serverfault.com/questions/868461/caching-of-jpg-files-fails-in-nginx
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 205
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready