search

Home  >  Q&A  >  body text

Why can’t Nginx cache be cleared?

Use Nginx as a static resource server, but found a tragedy.
I have updated the resource file in the root directory. It is a css file, but it is still old when I access it.
It's definitely not the browser cache, I just changed the browser. . .
Nginx doesn't work even after restarting. Why is Nginx cache so weird? What should I do?

漂亮男人漂亮男人2745 days ago799

reply all(5)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 17:32:09

    First of all, you must have configured proxy_cache_path. If nginx does not configure this parameter, it will not cache any files.
    To clear the configuration, delete all files in the directory configured by proxy_cache_path.

    find /proxy/cache/path -type f -delete

    Restarting Nginx is useless

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 17:32:09

    nginx’s caching service proxy_cache cannot clear the specified URL cache. It can only set the URL expiration time. To clear the specified URL, you can use the nginx third-party module ngx_cache_purge.
    When installing nginx, you need to load ngx_cache_purege into it.

    ./configure --user=www --group=www --add-module=/root/dxm/nginx/ngx_cache_purge-1.2

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-16 17:32:09

    Use memc-nginx and srcache-nginx modules to build efficient and transparent caching mechanism
    http://www.qixing318.com/article/using-memc-nginx-and-srcache-nginx-module-build-efficient-and-transparent -caching-mechanism.html

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-16 17:32:09

    If you are using virtualBox, this may be the reason

    VirtualBox Hates Sendfile
    Modify configuration sendfile off;

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-16 17:32:09

    Thank you upstairs! Mine was caused by this problem. After changing sendfile to OFF, it was fine!

    reply
    0
  • Cancelreply