95
Syntax: | proxy_next_upstream |
---|---|
Default: |
proxy_next_upstream error timeout; |
Context: | http , server , location |
生效前提:没有向客户端发送任何内容 如果向上游服务器发送一个字节说明已经发送生效了 这个指令就失效了
- 配置:error:与服务器建立连接、向其传递请求或读取响应头时出错;
- timeout:与服务器建立连接、向其传递请求或读取响应头时发生超时;
- invalid_header:服务器返回空响应或无效响应;
- http_:http_500、http_403 等这样错误
- non_idempotent:
- off:关闭这个功能
Syntax: | proxy_next_upstream_timeout |
---|---|
Default: |
proxy_next_upstream_timeout 0; |
Context: | http , server , location |
Syntax: | proxy_next_upstream_tries |
---|---|
Default: |
proxy_next_upstream_tries 0; |
Context: | http , server , location |
代码演示:
server { listen 8080; server_name shopp.com.cn;
location /httperr{
proxy_pass http://nextups;
proxy_next_upstream http_500; #与下面类同 将错误限定在 500错误的时候
}
location /error { proxy_pass http://nextups; proxy_connect_timeout 1s; proxy_next_upstream error; #当设置为非off得时候,假如一台上游服务器无法链接比如 8012服务器宕机了,那么用户请求会转发到8011端口,但是如果设置为off的话 则返回502错误 } } upstream nextups{ server 192.168.0.51:8012; server 192.168.0.51:8011; }
Syntax: | proxy_intercept_errors |
---|---|
Default: |
proxy_intercept_errors off; |
Context: | http , server , location |
error_page 500 502 503 504 /test.txt; location /intercept { root html; proxy_pass http://192.168.0.51:8013; proxy_intercept_errors on;#当指令启用为on时 则 error_page就生效了 目前指定了文件路径 使用了root指令 }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。