#一、代理模块
ngx_http_proxy_module
#二、代理配置
代理
Syntax: proxy_pass URL; #代理的后端服务器URL
Default: —
Context: location, if in location, limit_except
头信息
Syntax: proxy_set_header field value;
Default: proxy_set_header Host $proxy_host; #设置真实客户端地址
proxy_set_header Connection close;
Context: http, server, location
超时
Syntax: proxy_connect_timeout time;
Default: proxy_connect_timeout 60s; #链接超时
Context: http, server, location
Syntax: proxy_read_timeout time;
Default: proxy_read_timeout 60s;
Context: http, server, location
Syntax: proxy_send_timeout time; #nginx进程向fastcgi进程发送request的整个过程的超时时间
Default: proxy_send_timeout 60s;
Context: http, server, location
#三、启用 nginx proxy 代理
环境两台nginx真实服务器
###1. nginx-1 启动网站(内容)(作为网站服务器)
nginx-1的ip:192.168.181.128
# 编辑nginx的配置文件(编辑之前,删除/注释掉之前的配置):
[root@localhost ~]# cat /etc/nginx/conf.d/default.