0
votes

I've successfully built nginx 1.8 full with pagespeed module.

I'm serving a Django app.

I see that line in the header: X-Page-Speed: 1.10.33.2-7600

But when I tried to hit my https website I see several css and js files loaded.

this is my nginx settings file:

    pagespeed MapOriginDomain "http://localhost" "https://example.com";
    pagespeed LoadFromFile "https://example.com/" "/path/to/static/files";
    # let's speed up PageSpeed by storing it in the super duper fast memcached
    pagespeed MemcachedThreads 1;
    pagespeed MemcachedServers "localhost:11211";

  # Filter settings
  pagespeed RewriteLevel CoreFilters;
  pagespeed EnableFilters collapse_whitespace,remove_comments;

  #  Ensure requests for pagespeed optimized resources go to the pagespeed
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
    add_header "" "";
  }
  location ~ "^/ngx_pagespeed_static/" {
  }
  location ~ "^/ngx_pagespeed_beacon$" {
  }
  location /ngx_pagespeed_statistics {
    allow 127.0.0.1;
    deny all;
  }

What am I missing? I also noticed this line in the header:

Cache-Control: max-age=0, no-cache

it seems that the cache is disabled and I don't know why.

3

3 Answers

0
votes

Solution:

I just missed the /static in:

pagespeed LoadFromFile "https://example.com/static/" "/path/to/static/files";
0
votes

If you want to enable client-side cache, you must set the Cache-Control headers, for instance like this:

location ~* ^.+\.(css|js|gif|jpeg|jpg|png|ico)$ {
    expires 1d;
    add_header Cache-Control "public";
    access_log off;
    log_not_found off;
}

Another trick to speed-up your site is disabling access_log and log_not_found for static content. If you check your log I bet you will find many iPhone / apple specific fav icons hits that may result in HTTP 404

0
votes

try to add conf pagespeed FetchHttps enable,allow_self_signed; after line pagespeed MemcachedServers "localhost:11211";