开发者

Trouble setting expiration for static asset in nginx

开发者 https://www.devze.com 2022-12-18 15:48 出处:网络
I have the following location directive in my nginx config file: server{ ... location ~* \\.js$ {expires 1d;}

I have the following location directive in my nginx config file:

server{
  ...
  location ~* \.js$ {expires 1d;}
  .开发者_C百科..
  location / {
  ...
 }
}

I expect a file served by this URL http://www.mydomain.com/javascripts/myfile.js to have an expiration of +1 day, but I am seeing an expiration of +20 years. What am I doing wrong?


It turns out that I was supposed to edit proxy.conf. Once I did that, it worked swimmingly.

0

精彩评论

暂无评论...
验证码 换一张
取 消