[TriLUG] Using Apache 2 with Multiple domains

Aaron S. Joyner aaron at joyner.ws
Fri Jul 9 10:04:38 EDT 2004


Turnpike Man wrote:

>Email... kinda depends.  Do you need completely separate instances as if
>running 2 completely different email servers?  OR, like I do at home, I have
>all 3 domains I host separate websites at home all come into one email server,
>postfix.  This means username at example1.com, username at example2.net and
>username at example3.org all go into username's inbox.
>
This, as David describes is a piece of cake with most any mailer, via 
aliases.  Make the MTA (Postfix, Sendmail, Qmail, choose your own 
torture) accept mail for those domains, and then any user on the system 
(and any alias you setup for that user) gets mail at each of the 
addresses in each of the domains.

>I don't have a separate
>inbox for username in each domain per say.  If this is what you want, I can
>help, if you want it as if they were completely separate servers, well, I'd be
>interested to see how postfix gets setup that way, though I don't really need
>it myself.
>  
>
This actually isn't much harder.  Both Sendmail and Postfix do it rather 
easily via Virtual aliases, and both have very good documentation on how 
to set it up.  In principle, you setup a file something like this:
user1 at example.com   asjoyner
user2 at example2.com   user2
@example2.com user2

Now the only addresses in those domains are user1 in the first domain, 
and user2 in the second domain.  But in the second domain, any address 
is valid, and all mail to "other" addresses (ala spam at example2.com) goes 
to user2's mailbox.

Check out the documentation for your mailer, for the specifics.

Don't forget the DNS setups - each domain needs to have an MX record 
which points to the mail host for that domain.  To make the mailers 
active for the domain, check out /etc/mail/local-host-names for 
Sendmail, or $mydestinations in main.cf for Postfix.  Don't forget to 
reload each daemon after you change the config file, kill -HUP 
`sendmailpid` or postfix reload.

Enjoy!
Aaron S. Joyner



More information about the TriLUG mailing list