我想使用类似的东西:
location @a1 {
...
}
location @a2 {
...
}
location /path {
try_files @a1 $uri @a2
}
Run Code Online (Sandbox Code Playgroud)
是否有可能,我应该在@ a1位置继续尝试使用$ uri/@ a2?
如果是这样,nginx将如何处理?
我找到了这个解决方案:
location /static/ {
try_files $uri @static_svr1;
}
location @static_svr1{
proxy_pass http://192.168.1.11$uri;
proxy_intercept_errors on;
recursive_error_pages on;
error_page 404 = @static_svr2;
}
location @static_svr2{
proxy_pass http://192.168.1.12$uri;
proxy_intercept_errors on;
recursive_error_pages on;
error_page 404 = @static_svr3;
}
location @static_svr3{
proxy_pass http://192.168.1.13$uri;
}
Run Code Online (Sandbox Code Playgroud)
这个例子的作用如下:
try_files $uri @static_svr1 @static_svr2 @static_svr3
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5962 次 |
| 最近记录: |