首页 > 其他 > 详细

niginx代理配置

时间:2016-04-22 18:32:20      阅读:253      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!