欢迎来到日本小春精选,了解日本先从@日本生活基础课程开始!
欢迎 欢迎     登录 | 注册      消息
当前位置: 首页小组技术交流nginx反向代理设置 header

[Linux]nginx反向代理设置 header

<span style="line-height: 21px; color: rgb(68, 68, 68); font-size: 14px; font-family: Tahoma, 'Microsoft Yahei', Simsun; ">在nginx中设置:</span><br style="line-height: 21px; color: rgb(68, 68, 68); font-size: 14px; font-family: Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; " /><span style="line-height: 21px; color: rgb(68, 68, 68); font-size: 14px; font-family: Tahoma, 'Microsoft Yahei', Simsun; ">proxy_set_header&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;Host&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;$host;</span><br style="line-height: 21px; color: rgb(68, 68, 68); font-size: 14px; font-family: Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; " /><span style="line-height: 21px; color: rgb(68, 68, 68); font-size: 14px; font-family: Tahoma, 'Microsoft Yahei', Simsun; ">proxy_set_header&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;X-Real-IP&nbsp; &nbsp;&nbsp; &nbsp; $remote_addr;</span><br style="line-height: 21px; color: rgb(68, 68, 68); font-size: 14px; font-family: Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; " /><span style="line-height: 21px; color: rgb(68, 68, 68); font-size: 14px; font-family: Tahoma, 'Microsoft Yahei', Simsun; ">proxy_set_header&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;X-Forwarded-For $proxy_add_x_forwarded_for;</span><br style="line-height: 21px; color: rgb(68, 68, 68); font-size: 14px; font-family: Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; " /><span style="line-height: 21px; color: rgb(68, 68, 68); font-size: 14px; font-family: Tahoma, 'Microsoft Yahei', Simsun; ">后端程序可以从Server变量HTTP_X_REAL_<wbr>IP和HTTP_X_FORWARDED_<wbr>FOR中获取用户的ip地址。</wbr></wbr></span><br style="line-height: 21px; color: rgb(68, 68, 68); font-size: 14px; font-family: Tahoma, 'Microsoft Yahei', Simsun; word-wrap: break-word; " /><span style="line-height: 21px; color: rgb(68, 68, 68); font-size: 14px; font-family: Tahoma, 'Microsoft Yahei', Simsun; ">HTTP_X_REAL_<wbr>IP的值是nginx得到的用户REMOTE_ADDR</wbr></span>
2012-06-26 12:00:49 来自:球球
上一篇:PSCP命令
下一篇:nginx设置SSL反向代理
用户评论(0)
正序阅读
你的回应
登录 | 注册