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

How can I know the name of the cache file created by NGINX?

· 52CE 我爱测

Suppose I make a request, https://example.com/path1/2?v=1 , and have enabled the proxy caching. How do I know the name of the cache file created by NGINX? The problem is, I want to delete the cache for a single URL and do not wan…

问题原文

原帖链接 · Suhail Gupta · CC BY-SA 4.0

Suppose I make a request, https://example.com/path1/2?v=1, and have enabled the proxy caching. How do I know the name of the cache file created by NGINX? The problem is, I want to delete the cache for a single URL and do not want to clear the complete NGINX cache. How can I do this?

These are the files inside my NGINX cache directory.

已采纳解答

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

According to the documentation cache file name is a result of applying MD5 function to a result of proxy_cache_key evaluation.

What you can try:

  • check what's in proxy_cache_key in your config
  • evaluate all the variables like $host and $request_uri manually for your target request
  • md5-it (careful about the line ending character)
  • see if you can find the resulting file and try to move it to other place

MD5 without \n at the end:

printf "example.com/path1/2?v=1" | md5sum

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

资料来源与适用范围

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

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

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