本帖最后由 乐橙306 于 2016-3-31 14:18 编辑
- 此模块能代理请求到其它服务器.
- 这是 HTTP/1.0 版本的代理,暂时无法保持 keep-alive 的请求.(因此,到后端的链接每次请求都会创建和关闭)
- Nginx 和浏览器使用 HTTP/1.1 进行对话,而跟后台服务器使用 HTTP/1.0,所以它能处理浏览器keep-alive的请求
- 配置举例
- [root@wh-cnc-51 vhosts]# cat 81port.conf
- upstream 8070 {
- server 10.1.1.51:8070;
- server 10.1.1.51:8060 backup;
- }
- server
- {
- listen 81;
- server_name localhost;
- index index.jsp index.html index.htm;
- location / {
- proxy_pass http://8070/;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- }
- }
- [root@wh-cnc-51 vhosts]#
编辑回复