It is very common these days for a single system to host
many domains. For instance, http://oreillynet.com and http://onlamp.com might run on a single host, but act as
if they were two totally different hosts. A system usually has a canonical domain, which is considered its usual or common domain
name. Additional domains are configured as virtual domains. Each virtual domain can host services such as web
sites and email as if it were the only domain on a server. This chapter
explains several different mechanisms for hosting multiple domains. The
techniques are explained separately, but it is possible to mix techniques
if you must handle different domains in different ways.
To determine which technique or techniques you need, you must decide how Postfix should deliver messages for virtual domains. There are two important considerations that influence how you should configure Postfix for hosting multiple domains:
Should your domains have separate namespaces? For example, should mail for the two addresses info@ora.com and info@oreilly.com go to the same mailbox or separate ones? We’ll refer to the same mailbox scenario as shared domains, and the other as separate domains.
Does every user require a system account? We’ll make the distinction between system accounts that are real Unix accounts on your system and virtual accounts. With virtual accounts, users can have mailboxes on your server, but don’t otherwise log in to the system and don’t require an entry in /etc/passwd.
We’ll consider four different ways Postfix can handle mail for virtual domains:
Shared domains with system accounts
Separate domains with system accounts
Separate domains with virtual accounts
Virtual domains with a proprietary message store not managed by Postfix
Your POP/IMAP server will be a major factor in deciding which technique you need. If your POP/IMAP server does not understand virtual domains, then it will most likely require that you have system accounts for all addresses. Some POP/IMAP servers inherently support multiple domains, and deliver messages into a particular directory structure on the local filesystem. Other POP/IMAP servers use their own proprietary message store. Postfix can hand off messages to them using LMTP.
Regardless of the technique you use, all of your virtual domains must be configured correctly in DNS. You should configure DNS for virtual domains the same way you do for your system’s canonical domain. See Chapter 6 for information on Postfix and DNS.