Learn about Centmin Mod LEMP Stack today
Become a Member

Nginx PageSpeed How to check Pagespeed work with SSL well?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Josephm, Oct 23, 2014.

Tags:
  1. Josephm

    Josephm Active Member

    126
    43
    28
    Aug 26, 2014
    Ratings:
    +45
    Local Time:
    8:58 PM
    1.9.5
    10.0.21
    Hi all, I setup SSL/SPDY/Cloudflare quite well, and followed ngx_pagespeed install on Centmin Mod - Menu based Nginx installer for CentOS servers
    I tried curl but can't see X-Page-Speed version like the instruction.
    Code:
    curl -I http://yourdomainname.com
    
    HTTP/1.1 301 Moved Permanently
    Date: Thu, 23 Oct 2014 09:24:14 GMT
    Content-Type: text/html
    Connection: keep-alive
    Set-Cookie: __cfduid=d03d917f56e017504fe235a579af0d96e1414056254301; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.yourdomainname.com; HttpOnly
    Location: https://yourdomainname.com/
    Server: cloudflare-nginx
    CF-RAY: 17dce1646a591430-ORD
    
    I really appreciate for any comments. Thanks.
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,897
    6,908
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,403
    Local Time:
    11:58 PM
    Nginx 1.13.x
    MariaDB 5.5
    what about https version
    Code:
    curl -I https://yourdomainname.com
     
  3. Josephm

    Josephm Active Member

    126
    43
    28
    Aug 26, 2014
    Ratings:
    +45
    Local Time:
    8:58 PM
    1.9.5
    10.0.21
    wow, simple thinking :D, Thanks a lot @eva2000, maybe the "purge cache" in cloudflare helped me too.
    Code:
    curl -I https://www.yourdomainname.com
    HTTP/1.1 301 Moved Permanently
    Server: x engine
    Content-Type: text/html; charset=UTF-8
    Connection: keep-alive
    X-Pingback: https://yourdomainname.com/xmlrpc.php
    Location: https://yourdomainname.com/
    Alternate-Protocol: 443:npn-spdy/3
    Strict-Transport-Security: max-age=31536000; includeSubdomains;
    Date: Thu, 23 Oct 2014 09:56:25 GMT
    X-Page-Speed: 1.9.32.1-4238
    Cache-Control: max-age=0, no-cache
    
     
  4. Josephm

    Josephm Active Member

    126
    43
    28
    Aug 26, 2014
    Ratings:
    +45
    Local Time:
    8:58 PM
    1.9.5
    10.0.21
    Found a simple script to optimize Cache-control. Add this into vhost nginx conf:
    Code:
    location /home/nginx/domains/yourdomainname.com/public {
      location ~*\.(jpg|jpeg|gif|png|js|css)$ {
        add_header Cache-Control"public, max-age=600";
      }
    }
    
    
    and result will be below:
    Code:
    curl -I http://yourdomainname.com/wp-content/themes/eleven/images/logo.png
    HTTP/1.1 301 Moved Permanently
    Date: Thu, 23 Oct 2014 10:27:33 GMT
    Content-Type: text/html
    Connection: keep-alive
    Set-Cookie: __cfduid=d31478aab95e075ae85f3c740acf157ad1414060053772; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.yourdomainname.com; HttpOnly
    Location: https://yourdomainname.com/wp-content/themes/eleven/images/logo.png
    CF-Cache-Status: MISS
    Expires: Tue, 28 Oct 2014 10:27:33 GMT
    Cache-Control: public, max-age=432000
    Server: cloudflare-nginx
    CF-RAY: 17dd3e2811da0436-ORD
    
     
  5. eva2000

    eva2000 Administrator Staff Member

    30,897
    6,908
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,403
    Local Time:
    11:58 PM
    Nginx 1.13.x
    MariaDB 5.5
    ngx_pagespeed usually takes care of cache-control and so would cloudflare depending on cache settings (which shows max-age = 432,000 seconds or 5 days)

    at nginx level, Centmin Mod also does that via include file in vhost at /usr/local/nginx/conf/staticfiles.conf = 30 day cache
    Code:
        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)$$
            gzip_static off;
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
        location ~* \.(js)$ {
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
        location ~* \.(css)$ {
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
        location ~* \.(html|htm|txt)$ {
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 1d;
            break;
            }
    
        location ~* \.(eot|svg|ttf|woff)$ {
            #add_header Pragma public;
            add_header Cache-Control "public, must-revalidate, proxy-revalidate";
            access_log off;
            expires 30d;
            break;
            }
    
    
    so your 600 seconds is ignored
     
    • Like Like x 1