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

时间:2018-11-02 00:40:29

标签: amazon-ec2 dns cpanel amazon-route53

我尝试用弹性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?我需要什么?

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

2 个答案:

答案 0 :(得分:2)

您需要在两者之间引入代理服务器,就像在DNS中一样,您无法设置端口,因为每种请求类型的端口都已经定义。 您可以添加nginx或haproxy或任何其他反向代理服务器,这些服务器将接受所有请求并将请求传递到适当端口上的适当主机。

答案 1 :(得分: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.
相关问题