如何设置nginx以返回Cache-Control:no-store,no-cache,仅对html文件必须重新验证?

时间:2017-07-23 13:22:25

标签: nginx server

我有nginx服务器,想要阻止缓存我的网站html文件。我怎样才能做到这一点?

另外我想问一下nginx服务器配置和往常一样在哪里?

2 个答案:

答案 0 :(得分:0)

您可以将内容设置为0,如下所示,告诉浏览器始终从网络服务器加载内容

<meta http-equiv="expires" content="0">

Nginx配置默认位于/etc/nginx/

答案 1 :(得分:0)

ps -ef | grep nginx

您可以找到nginx主进程并查看它已加载的配置文件

设置一个标头,禁用html的缓存使用它:

location ~* \.(html)$ {
    add_header        Cache-Control "no-cache, must-revalidate";
}
相关问题