nginx 配置
2015-11-12 16:50
567 查看
upstream mash { ip_hash; server 127.0.0.1:8081; server 192.168.0.11:8081; } server { location / { if ($request_method = POST ) { proxy_next_upstream error; } if ($request_method = PUT ) { proxy_next_upstream error; } proxy_pass http://mash/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
proxy_next_upstream,这个配置指定了 nginx在从一个后端主机取数据遇到何种错误时会转到下一个后端主机,里头写上的就是会出现502的所有情况拉,默认是error timeout。error就是当机、断线之类的,timeout就是读取堵塞超时,比较容易理解
全部值包括:
proxy_next_upstream error | timeout | invalid_header | http_500 | http_502 | http_503 | http_504 | http_403 |
http_404 | off ...;
相关文章推荐
- centos安装配置nginx
- nginx问题汇总
- Cenos(6.6/7.1)下从源码安装Python+Django+uwsgi+nginx到写nginx的环境部署(一)
- nginx 端口转发
- nginx做白名单以及灰度流量控制
- nginx相关知识
- phalconphp nginx 配置
- (总结)Nginx配置文件nginx.conf中文详解
- Nginx+PHP On windows
- Nginx配置thinkPHP 支持phpinfo和rewrite
- Nginx配置文件详细说明
- Mogilefs分布式文件系统-Keepalived+Nginx双主模型实现图片分布式存储、访问
- Nginx安装
- 运行和控制Nginx
- nginx 支持thinkphp pathinfo最简单的方法
- 适用于Ubuntu的最新版Nginx源整理
- Nginx 中last和break 及 permanent 和 redirect 的爱恨情仇
- nginx进程模型
- NGINX
- ubuntu安装nodejs, nginx