nginx子域

use*_*820 2 subdomain ubuntu config nginx

好吧我似乎无法得到它,我已经检查了nginx论坛,也没有太多帮助.我觉得这很简单.我希望定义的子域名转到不同的URL /端口.即

DNS site.com goes to 192.168.1.1 w/ masking
DNS www.site.com goes 192.168.1.1 w/ masking
DNS red.site.com goes 192.168.1.1 w/ masking
DNS blue.site.com goes to 192.168.1.1 w/ masking
Run Code Online (Sandbox Code Playgroud)

我希望site.com和www.site.com正常运行,但我希望red.site.com转到192.168.1.2:5000和blue.site.com转到192.168.1.2:6000/temp/

等等....我甚至不确定我关心地址栏中显示的内容,我想如果它保持red.site.com会很好,但这并不重要.我已经尝试过代理传递url重写,显然我做错了.这甚至可能吗?

gip*_*ipi 5

您是否尝试过Proxy传递指令?

有类似的东西

server {
  server_name red.site.com;

  location  / {
    proxy_pass http://192.168.1.2:5000;
  }
}
server {
  server_name blue.site.com;

  location  / {
    proxy_pass 192.168.1.2:6000/temp/;
  }
}
Run Code Online (Sandbox Code Playgroud)

应该管用.查看有关标题转发等文档的文档...