简体   繁体   English

关于Wordpress Nginx安装的缓存问题。

[英]Caching issue on Wordpress Nginx installation.

We are running an NGINX server and are experiencing strange caching behaviour. 我们正在运行NGINX服务器,并且遇到奇怪的缓存行为。 The site is Wordpress running Fastest Cache. 该站点是运行最快缓存的Wordpress。 The cache control on the response headers consistently says: 响应头上的缓存控件始终表示:

max-age=0, no-cache, no-store, must-revalidate max-age = 0,无缓存,无存储,必须重新验证

The website is [boxChilli][ https://www.boxchilli.com/] 该网站是[boxChilli] [ https://www.boxchilli.com/]

I have tried everything to get the site to cache correctly but I thought it best to throw this open to the community. 我已尽一切努力使网站正确缓存,但我认为最好向社区开放。

Because the HTML files are not cached, so it says no-cache for html files, and its storing age as max-age:0 to indicate the contents are served from server always. 由于未缓存HTML文件,因此它表示html文件不缓存,其存储期限为max-age:0,以指示始终从服务器提供内容。 But the rest of the contents should be cached, if nginx is configured as following. 但是,如果nginx的配置如下,则应缓存其余内容。

Please try this tutorial written by me. 请尝试我写的本教程。 I explained everything in detailed. 我详细解释了所有内容。 http://nucuta.com/wp-fastest-cache-configuration-for-nginx/ http://nucuta.com/wp-fastest-cache-configuration-for-nginx/

Additionally use this in nginx.conf in /etc/nginx/ you don't have to mention text/html as html files are compressed in default. 另外,在/ etc / nginx /中的nginx.conf中使用它,您不必提及text / html,因为html文件是默认压缩的。

gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

And in default file in /etc/nginx/sites-enabled/ 并且在/ etc / nginx / sites-enabled /中的默认文件中

location ~* \.(css|gif|ico|jpeg|jpg|js|png|woff|woff2|ttf|ttc|otf|eot)$ {
        expires max;
        log_not_found off;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM