How to implement js css without caching in nginx

藏色散人
Release: 2023-01-04 09:37:06
Original
3256 people have browsed it

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.

How to implement js css without caching in nginx

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.

How to implement js css without caching 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;
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!