端口通过主机名重定向到docker容器 [英] port redirect to docker containers by hostname
问题描述
我想要从一个服务器设置多个站点:
I want to setup serve multiple sites from one server:
1. http://www.example.org => node.js-www (running on port (50000)
2. http://files.example.org => node.js-files (running on port 50001)
到目前为止,我只发现在使用静态ips时,docker做端口重定向。
Until now I only found out to have docker doing port redirect when using static ips.
实际上是否可以通过主机名使用docker进行端口重定向?
Is is actual possible to use docker for port redirection via hostname?
我使用免费的亚马逊EC2 insance。
感谢
Bo
Thanks Bo
编辑:
我想要有多个节点
EDIT: I want to have multiple nodes applications running on the same port but however serving a different hostname.
推荐答案
据我所知,docker没有这样的功能内置,也不应该。
为了完成你想要做的事情,你可能需要一些反向代理,所以node.js或者nginx会做的,Bouncy可能是一个很好的选择: https://github.com/substack/bouncy
As far as I'm aware docker does not have such functionality built in, nor it should. To accomplish what you're trying to do you'd probably need some sort of reverse proxy, so node.js or nginx would do. Bouncy might be a good option: https://github.com/substack/bouncy
这篇关于端口通过主机名重定向到docker容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!