6
1. 禁用 PHP 页面缓存
location ~ \.php$ {
fastcgi_pass php_wordpress1;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
include fastcgi_params;
fastcgi_param PHP_VALUE "open_basedir=/var/www/html:/tmp";
fastcgi_param HTTPS on;
fastcgi_param SERVER_PORT 443;
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
add_header Expires "0";
}
2. 临时禁用静态文件缓存
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2)$ {
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
access_log off;
}