nginx html 缓存及不缓存配置

随手记录一下,nginx 缓存|不缓存

server {
        listen       18080;
        #listen        80;
        server_name  localhost;
        error_page   500 502 503 504  /50x.html;
        
		location / {
	           root /Users/huangqingpeng/Desktop/workspaces/qiankun/vue-qiankun-demo/dist;
         	   try_files $uri $uri/ /index.html;
          	   index  index.html index.htm;
          	   
                if ($request_filename ~* .*\.(?:htm|html)$)
                 {
                    add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
                  }
                 if ($request_filename ~* .*\.(?:js|css)$)
                 {
                   expires      7d;
                 }
                if ($request_filename ~* .*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm)$)
                {
                  expires      7d;
                }
              }

你可能感兴趣的:(linux常用基础技能及服务,#,Nginx,nginx,缓存,html不缓存,css缓存)