如何配置Nginx缓存除index.html和service-worker.js之外的所有内容?

时间:2019-12-05 12:12:16

标签: nginx progressive-web-apps nginx-config

我有一个pwa,并且我不想缓存index.htmlservice-worker.js,如何配置nginx

这是我的配置:

server {
  server_name xxx.com;
  root path/static_dir;
  index index.html;

  location / {
    try_files $uri $uri/ @rewrites;
  }

  location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
    expires max;
  }
}

0 个答案:

没有答案