如果我在同一台VPS上运行Apache和Postfix,我该如何设置主机名和DNS记录?

3

我最近租用了一个VPS(Ubuntu 12.04)来托管一些带有域名的网站,并且最近设置了Postfix / Dovecot作为邮件服务器。名称服务器记录指向我的注册商的名称服务器。

我有几个域名(domain1.com,domain2.com,domain3.com),它们的A记录指向我设置了基于名称的虚拟主机的VPS的IP地址。

我想象中,一旦正确设置,我就可以在电子邮件客户端上将mail.domain1.com输入为我的pop3 / imap / smtp邮件服务器,以及我的用户名和密码。对于其他域名也可以这样做。

有人能告诉我这个应该是怎样正确设置A和MX DNS记录,以及我应该如何在我的vps上设置主机名和在postfix / dovecot设置中设置主机名?

例如,我已将我的vps主机名设置为domain1.com,我将其放在了postfix / dovecot配置文件中,但不确定是否应该将其设置为mail.domain1.com? 我是否需要将mail,imap,pop,smtp的CNAME设置为指向MX记录或A记录,以便可以在所有记录上都访问该服务器?

非常感谢您提供的任何帮助 :)


这个答案应该会对你有所帮助 http://serverfault.com/a/579780/184188 - clement
谢谢您的建议,但答案似乎过于针对提问者的情况,不适用于我的情况。 - luciditydave
1个回答

7
假设您在具有IP地址1.2.3.4的VPS上托管了三个域名domain1.comdomain2.comdomain3.com的邮件服务器。
  • POP3/IMAP/SMTP DNS records are used by your customers to send/receive mails by configuring their mail clients. So set the following A records.

    mail.domain1.com  A 1.2.3.4
    mail.domain2.com  A 1.2.3.4
    mail.domain3.com  A 1.2.3.4
    
  • To receive mails on the same server for all your domains, set the MX records for all the domains as follows.

    domain1.com MX mail.domain1.com
    domain2.com MX mail.domain2.com
    domain3.com MX mail.domain3.com
    
  • Your system name has nothing to do with the mail server setup.

Postfix设置:

由于您的Postfix实例将处理多个域名,您可以为Postfix服务器设置一个白标签myhostname,例如somedomain.tld,或使用其中一个mail.domain1.commail.domain2.commail.domain3.com。 如果您计划使用mail.domain1.com作为邮件服务器名称(在Postfix中的myhostname值),并且您的服务器具有1.2.3.4 IP,并且您将处理domain1.comdomain2.comdomain3.com的邮件,则始终建议设置以下所有内容。

  • A记录指向1.2.3.4mail.domain1.com
  • PTR记录指向mail.domain1.com1.2.3.4
  • SPF记录应包括1.2.3.4domain1.comdomain2.comdomain3.com

希望能对您有所帮助。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接