码迷,mamicode.com
首页 > 其他好文 > 详细

niginx代理配置

时间:2016-04-22 18:32:48      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:

常用关键词:rewrite、proxy_pass

 

location ^~ /address/ {
    proxy_set_header Host xx.sohu.com; #设置header
    proxy_set_header Origin http://xx.sohu.com;
    #proxy_set_header Cookie "$http_cookie; coder=lxf"; #一般cookie会自动转发,此处可以追加cookie
    #proxy_pass    http://192.168.1.1:8888/; # hostNow/address/a 转发至 hostOther/a,等效于下面两行
	rewrite /address/(.+)$ /$1 break; #正则匹配
	proxy_pass    http://192.168.1.1:8888;
}

location ~ (getList|search|folders) { #正则匹配
    proxy_set_header Host free-mail-backend-test.sce.sohuno.com;
    proxy_set_header Origin http://free-mail-backend-test.sce.sohuno.com;
    proxy_pass    http://free-mail-backend-test.sce.sohuno.com;
}

  

参考:

http://www.cnblogs.com/AloneSword/p/3673829.html
http://linux.it.net.cn/e/server/nginx/2014/0709/2704.html

 

niginx代理配置

标签:

原文地址:http://www.cnblogs.com/youryida/p/5422067.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!