nginx转发

1. 根据设备转发到不同的url
       location /api/helper/download {
  

    if ($http_user_agent ~* "^(.*iphone.*)$") {
	rewrite ^ https://zc.pgyer.com/zfoi redirect;
	break;
   }
   
    if ($http_user_agent ~* "^(.*android.*)$") {
	rewrite ^ https://www.pgyer.com/kg5T redirect;
	break;
   }
   }
2. 转发到内网服务器,内网服务器在防火墙做NAT映射
    域名解析到云服务器之后,配置转发到内网出口ip
    server {
	listen 80;

	server_name test.zlt.com;
	allow 212.115.148.228;
	deny all;
	location / {
		proxy_pass http://212.115.148.228:65438;
	}



}
 

  

  

posted @ 2019-08-28 11:25  MlxgzZ  阅读(415)  评论(0编辑  收藏  举报