今天在一台服务器配置WordPress Nginx FastCGI Cache时发现一个奇妙的问题,WordPress固定链接设置为以html
为后缀,那么WordPress的文章页就是以html
结尾,此时会出现404 Not Found
这种奇怪的现象。
研究发现是对html后缀的页面设置了不缓存:
# Don't cache appcache, document html and data. location ~* \.(?:manifest|appcache|html?|xml|json)$ { expires 0; }
改为:
location ~* \.(?:manifest|appcache|xml|json)$ { expires 0; }
参考文档:
https://www.nginx.com/blog/9-tips-for-improving-wordpress-performance-with-nginx/
https://spinupwp.com/wordpress-static-site-nginx-page-caching/
https://github.com/deliciousbrains/wordpress-nginx