反向代理、ngx_http_upstream_module模块
2017-03-01 00:00
204 查看
#反向代理
给客户端的代理,就是代理,给服务器的代理,就是反向代理,把接受到的请求,分发给具体的web服务器。
如上边例子,访问这个server切路径为/的时候,就会访问到192.168.6.3:8080这个web服务器上去。
#ngx_http_upstream_module模块
ngx_http_upstream_module模块 允许定义一组服务器。它们可以在指令proxy_pass、 fastcgi_pass和 memcached_pass中被引用到。反向代理集群
Upstream定义一个名为backend的服务器组。然后在server.location的反向代理标签中proxy_pass后边跟上这个服务器组的名称,就可以反向代理到这个集群上了。
Upstream可以在server后边跟上weight来配置集群的权重,来到达负载均衡。
backup是备份服务器,只有当所有的正常服务器都不可以访问的时候启用,只要有一台服务器还能用,就不启用这个备份服务器。
unix:/tmp/backend3是UNIX 套接字(socket)
给客户端的代理,就是代理,给服务器的代理,就是反向代理,把接受到的请求,分发给具体的web服务器。
location / { proxy_pass http://192.168.6.3:8080/; }
如上边例子,访问这个server切路径为/的时候,就会访问到192.168.6.3:8080这个web服务器上去。
#ngx_http_upstream_module模块
ngx_http_upstream_module模块 允许定义一组服务器。它们可以在指令proxy_pass、 fastcgi_pass和 memcached_pass中被引用到。反向代理集群
upstream backend { server backend1.example.com weight=5; server backend2.example.com:8080; server unix:/tmp/backend3; server backup1.example.com:8080 backup; server backup2.example.com:8080 backup; } server { location / { proxy_pass http://backend; } }
Upstream定义一个名为backend的服务器组。然后在server.location的反向代理标签中proxy_pass后边跟上这个服务器组的名称,就可以反向代理到这个集群上了。
Upstream可以在server后边跟上weight来配置集群的权重,来到达负载均衡。
backup是备份服务器,只有当所有的正常服务器都不可以访问的时候启用,只要有一台服务器还能用,就不启用这个备份服务器。
unix:/tmp/backend3是UNIX 套接字(socket)
相关文章推荐
- nginx修改upstream不重启的方法(ngx_http_dyups_module模块)
- nginx修改upstream不重启的方法(ngx_http_dyups_module模块)
- nginx修改upstream不重启的方法(ngx_http_dyups_module模块)
- nginx健康检测(ngx_http_upstream_check_module 淘宝)
- 详细解释:nginx中ChsHttpUpstreamModule模块配置及各个参数含义
- 十二.健康检查模块功能(ngx_http_upstream_check_module)
- nginx 负载均衡之 ngx_http_upstream_hash_module
- Nginx 负载均衡模块 ngx_http_upstream_module 详述
- nginx 负载均衡之 ngx_http_upstream_hash_module
- 详细解释:nginx中ChsHttpUpstreamModule模块配置及各个参数含义
- nginx 负载均衡之 ngx_http_upstream_hash_module
- ngx_http_upstream_process_header流程分析
- Nginx 负载均衡模块 ngx_http_upstream_module 详述
- Nginx配置负载均衡(upstream)+反向代理(httpproxy)
- Tengine 中 ngx_http_accesskey 在反向代理中 如何和HTTP_PROXY配合使用
- 详细解释:nginx中ngx_http_headers_module模块配置及各个参数含义
- 详细解释:nginx中ngx_http_headers_module模块配置及各个参数含义
- nginx限制连接数ngx_http_limit_conn_module模块
- ngx_http_auth_basic_module模块
- ngx_http_upstream_keepalive_module原理分析