我在Nginx 0.8.54 上尝试尽可能 DRYly 实现以下目标:
localhost:8060
cookie no_cache
istrue
或 if request method is not GET
。$document_root/static/$uri
.$document_root/cache/$uri
和$document_root/cache/$uri.html
。/
,请不要尝试静态文件,而只尝试$document_root/cache/index.html
.localhost:8060
既没有找到静态文件也没有找到缓存文件的情况。当前配置文件:
server {
root /srv/web/example.com;
server_name example.com;
location @backend { proxy_pass http://localhost:8060; }
location / {
if ($cookie_no_cache = true) { proxy_pass http://localhost:8060; }
if ($request_method != GET) { proxy_pass http://localhost:8060; }
try_files /static/$uri /cache/$uri /cache/$uri.html @backend;
}
location = / {
if …
Run Code Online (Sandbox Code Playgroud)