Home >Web Front-end >Front-end Q&A >How to implement js css without caching in nginx
The method for nginx to implement js css without caching: first find and open the nginx.conf file in the nginx installation directory; then configure the content as "location ~ \.(js|css|html|png|jpg)$ {add_header...}" can be done.
The operating environment of this tutorial: Windows NT system, nginx1.14&&css3 version, thinkpad t480 computer.
Recommended: "css video tutorial"
When developing locally, we often encounter inexplicable problems caused by cache. The most violent way is to clear the browser The server's cache, or use Ctrl F5, Shift F5 to force refresh the page.
Sometimes after pressing it several times, the cache still cannot be cleared. The only way is to temporarily disable the browser's static resource cache. Just modify the .conf file in nginx.
Find the nginx.conf file in the nginx installation directory and configure it as follows:
location / { ... } #下面这个就是禁止缓存 location ~ \.(js|css|html|png|jpg)$ { add_header Cache-Control no-store; }
The above is the detailed content of How to implement js css without caching in nginx. For more information, please follow other related articles on the PHP Chinese website!