location / {#root html;
root d:/webroot;
index index.html index.htm;
if (!-e $request_filename) { proxy_pass http://localhost:8080; }
if (-e $request_filename) { add_header Cache-Control max-age=12345000;}
本文详细介绍了如何使用Nginx进行静态资源缓存控制及反向代理设置。通过具体实例展示了如何为不同请求设置缓存过期时间,并针对不存在的文件启用反向代理到本地另一端口的服务。这对于提高网站性能和服务可用性至关重要。
location / {if (!-e $request_filename) { proxy_pass http://localhost:8080; }
if (-e $request_filename) { add_header Cache-Control max-age=12345000;}
1万+
3929

被折叠的 条评论
为什么被折叠?