大网数据广告活动
服务器运维问答

Clear cache on nginx server

· 52CE 我爱测

I have a server, when I'm developing a website on my local machine I want to upload it to test it on the production server, however I'm facing a problem from the mobile phone I still get the old version of the server, on the PC I…

问题原文

原帖链接 · Buildermine · CC BY-SA 4.0

I have a server, when I'm developing a website on my local machine I want to upload it to test it on the production server, however I'm facing a problem from the mobile phone I still get the old version of the server, on the PC I can do a hard refresh however on mobile phone I keep wait until the website refresh is there any solution for this problem? can I clear cache on the server or any other solution?

已采纳解答

原帖链接 · djdomi · CC BY-SA 4.0

for nginx it would be easy

include this in server or location

proxy_cache_bypass                      $http_upgrade;
proxy_no_cache                          1;
proxy_cache_bypass                      1;
proxy_redirect                          off;
proxy_cache                             off;
add_header                      'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
 expires -1;

i used /etc/nginx/nocache.conf with the above content and just using include nocache.conf

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-12-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。