修改nginx的conf配置文件
关键配置
location / {
proxy_pass http://myServer;
proxy_set_header Host $host;
root html;
index index.html index.htm;
}
location ~ .* {
proxy_pass http://myServer; #请求转向myServer定义的服务器列表
#把原有http请求头中的Host字段也放到转发的请求头
proxy_set_header Host $http_host;
#HTTP的请求端真实的IP,只有在通过了HTTP 代理或者负载均衡服务器时才会添加该项
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}