I've just reinstalled my machine to remove old dependencies and install things in a more proper way and I've just realised the cache seems wrong now.
Headers are as follow for an image:
cache-control:max-age=300
content-type:image/png
date:Wed, 09 Nov 2016 13:17:50 GMT
expires:Wed, 09 Nov 2016 13:22:50 GMT
last-modified:Wed, 09 Nov 2016 12:25:44 GMT
server:nginx/1.11.5
status:200
As you may see the expire is 5m
. However the cache block is set to this:
location /assets {
alias /var/www/f13/content/themes/lechuck/assets;
access_log off;
expires max;
}
So it should be 10y
.
Here's the whole file:
# sets the proxy cache path location, max size 2g
proxy_cache_path /usr/local/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g;
# uses the defined STATIC cache zone
proxy_cache STATIC;
# cache 200 10 minutes, 404 1 minute, others status codes not cached
proxy_cache_valid 200 10m;
proxy_cache_valid 404 1m;
proxy_cache_key "$scheme$host$request_uri";
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_http_version 1.1;
# transfers real client IP to your ghost app,
# otherwise you would see your server ip
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
client_max_body_size 20m;
client_body_buffer_size 128k;
# default expires (browser cache) set to 1 minute
expires 1m;
# gzip every proxied responses
gzip_proxied any;
# gzip only if user asks it
gzip_vary on;
# gzip only theses mime types
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json application/javascript;
gzip_static on;
# add a cache HIT/MISS header
add_header X-Cache $upstream_cache_status;
# do not show incoming Etags, if-modified-since is sufficient
proxy_hide_header Etag;
# server {
# listen 80;
# server_name funcion13.com;
# return 301 https://$server_name$request_uri;
# }
server {
listen 80;
listen 443 ssl;
server_name funcion13.com;
root /var/www/f13/;
include /usr/local/nginx/conf/nginx-ssl.conf;
ssl_certificate_key /etc/letsencrypt/live/www.funcion13.com/privkey.pem;
ssl_certificate /etc/letsencrypt/live/www.funcion13.com/fullchain.pem;
return 301 https://www.funcion13.com$request_uri;
}
server {
listen 80;
listen 443 ssl http2 default_server;
listen [::]:443 http2 default_server ipv6only=on;
server_name www.funcion13.com; # Replace with your domain
include /usr/local/nginx/conf/nginx-ssl.conf;
ssl_certificate_key /etc/letsencrypt/live/www.funcion13.com/privkey.pem;
ssl_certificate /etc/letsencrypt/live/www.funcion13.com/fullchain.pem;
root /var/www/f13/;
index index.html index.htm;
client_max_body_size 10G;
pagespeed on;
pagespeed FetchHttps enable;
pagespeed RewriteLevel CoreFilters;
pagespeed EnableFilters move_css_above_scripts;
pagespeed EnableFilters defer_javascript;
pagespeed EnableFilters lazyload_images;
pagespeed EnableFilters inline_google_font_css;
pagespeed EnableFilters prioritize_critical_css;
pagespeed UseExperimentalJsMinifier on;
pagespeed EnableFilters insert_dns_prefetch;
pagespeed EnableFilters collapse_whitespace;
pagespeed LoadFromFile "https://www.funcion13.com/content" "/var/www/f13/content/";
pagespeed LoadFromFile "https://www.funcion13.com/assets" "/var/www/f13/content/themes/lechuck/assets/";
pagespeed SslCertDirectory "/etc/ssl/certs";
# Needs to exist and be writable by nginx. Use tmpfs for best performance.
pagespeed FileCachePath /usr/local/nginx/ngx_pagespeed_cache;
# Ensure requests for pagespeed optimized resources go to the pagespeed handler
# and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" {
expires off;
}
location ~ "^/ngx_pagespeed_beacon$" { }
location ~ /\.well-known\/acme-challenge {
allow all;
}
location / {
proxy_cache STATIC;
proxy_cache_valid 200 30m;
proxy_cache_valid 404 1m;
proxy_pass http://127.0.0.1:2368;
proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
proxy_ignore_headers Set-Cookie;
proxy_hide_header Set-Cookie;
proxy_hide_header X-powered-by;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_intercept_errors on;
rewrite "\d{4}\/\d{2}\/\d{2}\/([^.]+)(.*)$" /$1$2 permanent;
rewrite ^(/wp-content/)(.*)$ /old/$2 permanent;
expires 10m;
}
location /content/images {
alias /var/www/f13/content/images;
access_log off;
expires max;
}
location /old {
alias /var/www/f13/content/old;
access_log off;
expires max;
}
location /dmx {
alias /var/www/f13/content/dmo;
access_log off;
expires max;
}
location /assets {
alias /var/www/f13/content/themes/lechuck/assets;
access_log off;
expires max;
}
location /public {
alias /var/www/f13/core/built/public;
access_log off;
expires max;
}
location /ghost/scripts {
alias /var/www/f13/core/built/scripts;
access_log off;
expires max;
}
location ~ ^/(?:ghost|signout) {
expires 0;
add_header Cache-Control "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0";
proxy_pass http://127.0.0.1:2368;
}
}
upstream ghost {
server localhost:2368;
keepalive 64;
}
Any idea on what could be going on?