Caching 未指定Nginx浏览器缓存过期时间

Caching 未指定Nginx浏览器缓存过期时间,caching,nginx,browser,config,browser-cache,Caching,Nginx,Browser,Config,Browser Cache,对于nginx和服务器配置,我是个新手 我似乎无法设置浏览器缓存过期时间。我不知道我做错了什么。当我在Gtmetrix上测试它时,它说“未指定过期时间”。我希望你能帮我做这件事 # Virtual host file starts here server { listen 80; access_log /var/log/nginx/access.upholsterycleanigs.com.aulog; error_log /var/log/nginx/error.upholste

对于nginx和服务器配置,我是个新手

我似乎无法设置浏览器缓存过期时间。我不知道我做错了什么。当我在Gtmetrix上测试它时,它说“未指定过期时间”。我希望你能帮我做这件事

# Virtual host file starts here

server {
  listen 80;
  access_log /var/log/nginx/access.upholsterycleanigs.com.aulog;
  error_log /var/log/nginx/error.upholsterycleanings.com.au.log;
  server_name upholsterycleanings.com.au www.upholsterycleanings.com.au;
  root /home/upholsterycleanings/public_html;
  location / {
    location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso|woff|ttf|svg|eot)$ {
      expires 30d; #Comment this out if you are using the apache backend cache-control/expires headers.
      try_files \$uri \@backend;
    }
    error_page 405 = \@backend;
    error_page 500 = \@custom;
    add_header X-Cache "HIT from Backend";
    proxy_pass http://172.31.37.201:8181;
    include proxy.inc;
  }
  location \@backend {
    internal;
    proxy_pass http://172.31.37.201:8181;
    include proxy.inc;
  }
  location \@custom {
    internal;
    proxy_pass http://172.31.37.201:8181;
    include proxy.inc;
  }
  location ~ .*\.(php|jsp|cgi|pl|py)?\$ {
    proxy_pass http://172.31.37.201:8181;
    include proxy.inc;
  }
  location ~ /\.ht {
    deny all;
  }
}

# Virtual host file ends here

谢谢大家!

“未指定过期时间”用于本地文件或从@backend?交付的文件,用于静态资产,如jpg、css、js。。。