Want more timely Centmin Mod News Updates?
Become a Member

Nginx Leverage browser caching

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Alex, Sep 19, 2014.

  1. Alex

    Alex New Member

    22
    4
    3
    Jun 18, 2014
    Ratings:
    +4
    Local Time:
    2:28 AM
    1.4.6
    Gday, just trying to get browser caching working.

    My domain.com.conf contains: include /usr/local/nginx/conf/staticfiles.conf;

    The staticfiles.conf contains:
    location ~* \.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|eot|svg|ttf|woff)$ {
    gzip_static off;
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    access_log off;
    expires 30d;
    break;
    }

    location ~* \.(html|htm|txt|js|css)$ {
    add_header Pragma public;
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    access_log off;
    expires 30d;
    break;
    }


    But still the js is not being cached so GTmetrix etc is having a whinge...

    Any ideas?

    Cheers
     
  2. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:28 AM
    Nginx 1.13.x
    MariaDB 5.5
    @Alex

    Should work unless gtmetrix is complaining about 3rd party urls which you would not have any control over

    what version of Centmin Mod you using ?
     
  3. Alex

    Alex New Member

    22
    4
    3
    Jun 18, 2014
    Ratings:
    +4
    Local Time:
    2:28 AM
    1.4.6
    Centmin Mod 1.2.3-eva2000.01

    Ah... my bad... yes of course... they were 3rd party urls... google analytics, jquery etc...
     
    • Like Like x 1
  4. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:28 AM
    Nginx 1.13.x
    MariaDB 5.5
  5. Alex

    Alex New Member

    22
    4
    3
    Jun 18, 2014
    Ratings:
    +4
    Local Time:
    2:28 AM
    1.4.6
    Haha yeah, too scared to update, thinking it might break something...
     
  6. eva2000

    eva2000 Administrator Staff Member

    28,957
    6,573
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,755
    Local Time:
    2:28 AM
    Nginx 1.13.x
    MariaDB 5.5
  7. Alex

    Alex New Member

    22
    4
    3
    Jun 18, 2014
    Ratings:
    +4
    Local Time:
    2:28 AM
    1.4.6
    yeah good idea, thanks :)