HTTP proxy 模块

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

2016-03-13 10:46 举报
已邀请:
0

心怡呆呆

赞同来自:

虽然,有的看不懂,但是我还得赞一个,感谢分享

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: