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;
# 测试阶段注释掉缓存配置
# fastcgi_cache WORDPRESS;
# fastcgi_cache_valid 200 301 302 10m;
# fastcgi_cache_use_stale error timeout updating http_500 http_503;
# fastcgi_cache_key "$scheme$request_method$host$request_uri";
# add_header X-Cache $upstream_cache_status;
# 添加无缓存头用于测试
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;
}
「点点赞赏,手留余香」
声明:本文为原创文章,版权归旷野小站所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ linux虚拟机挂载win主机共享文件夹02/16
- ♥ lsyncd-实时同步11/01
- ♥ Dodker命令详解笔记03/07
- ♥ linux中Update-rc.d 命令用法详解02/06
- ♥ vim中查找和替换命令详解02/04
- ♥ phpmyadmin导入提示 near “ON” at position 2504/14