使用 Nginx FastCGI 生成AMP快取的conf
fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=tainanoutook:200m max_size=10g inactive=2h use_temp_path=off;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
set $skip_cache 1;
if ($request_uri ~* "/.*?amp") {
set $skip_cache 0;
}
include snippets/fastcgi-php.conf;
fastcgi_cache tainanoutook;
fastcgi_cache_valid 200 301 302 2h;
fastcgi_cache_use_stale error timeout updating invalid_header http_500 http_503;
fastcgi_cache_min_uses 1;
fastcgi_cache_lock on;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
add_header X-FastCGI-Cache $upstream_cache_status;
我的語法,由於我的頁面本身就有drupal的快取服務,但這個快取服務在amp起不了作用,所以才使用這招
作法就是只讓有*?amp產出快取;另外還要研究登入使用者不用快取,可能要研究drupal的cookie吧?
參考頁面
https://www.linode.com/docs/guides/how-to-use-nginx-fastcgi-page-cache-with-wordpress/
留言