将不同主机的多个IP地址指向具有不同端口的同一域名

问题描述 投票:0回答:2

我尝试使用弹性IP地址创建Amazon EC2实例。在那里我部署了Bitnami的MEAN应用程序。

另一方面,我们有一个CPanel(未部署在亚马逊,我认为它是Apache,不确定,我不是部署它的人)

Cpanel已经指向www.example.com,因此我们可以通过www.example.com:2082访问cpanel,但默认的www.example.com:80为空/空。我们正在使用Cpanel作为邮件服务器。

我需要做的是将Amazon EC2公共IP和DNS指向www.example.com:80。我可以在Cpanel DNS区域编辑器中进行设置吗?或者我是否需要设置Amazon Route 53?我需要什么?

如果我在亚马逊的Cpanel DNS区域编辑器中创建新的A记录,我将无法访问Cpanel www.example.com:2082。我现在真的很困惑。请帮忙。

amazon-ec2 dns cpanel amazon-route53
2个回答
2
投票

您需要在两者之间引入代理服务器来执行此操作,因为在DNS中您无法设置端口,因为已经定义了每种类型的请求端口。您可以添加nginx或haproxy或任何其他反向代理服务器,它将接受所有请求并将请求传递到适当端口上的相应主机。


0
投票

我知道它有点晚了,以防你仍然需要它或有人遇到这个:

无需代理。

You point the A record for example.com to EC2 IP.
CNAME for WWW to example.com
Then you should have an A record for mail.example.com for your cPanel IP
Your MX records should point to mail.example.com and not to example.com.
And you can access cPanel at mail.example.com:2082 or whatever the server's IP or main hostname is. The main hostname has the advantage that you can use port 2083 for SSL cPanel connections
Just make sure the e-mail clients use mail.example.com and not example.com as the connecting mail server.
© www.soinside.com 2019 - 2024. All rights reserved.