我们具有ID分区和子域的页面缓存。说出诸如ny.site.com/cat/12345
或之类的请求la.site.com/dog/234
,nginx需要
/cat/ny/1234/5.html
存在,返回request_uri
文件打入应用程序服务器,就会创建缓存文件我们设法弄清楚了子域和id分区部分,但是try_files部分没有任何运气。总是出现不确定的循环错误,例如rewrite or internal redirection cycle while internally redirecting to
我们的nginx.conf文件就像
rewrite "/cat/([0-9]{4})([0-9]{1,4})" /system/cache/cat/$subdomain/$1/$2.html break;
rewrite "/cat/([0-9]{1,4})" /system/cache/cat/$subdomain/$1.html break;
try_files $uri $request_uri;
有什么提示吗?谢谢!
更新:我尝试了以下方法。Nginx在文件系统中寻找$ request_uri(例如/ cat / 12345),而不是点击应用服务器。有什么想法吗?
try_files $uri @old;
location @old {
rewrite ^ $request_uri break;
}
试试这个
location ^~ ^/cat/([0-9]{4})([0-9]{1,4}) {
try_files "/cat/ny/$1/$2.html" @app_server;
}
location @app_server{
# pass this to your app server for processing.
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句