Hosting domains/subdomains across multiple servers

Posted by on Apr 7, 2009 in Web Development | No Comments

Just a quick, but important note about local and remote domains on Unix-type systems when you have a domain that has some functions on one machine and other functions on another machine… don’t forget to set localdomains and remotedomains appropriately.

For example, say you have www.domain.com on Machine A, and dev.domain.com on Machine B. Machine A is configured as the main web site and mail server. Some environments (and I’m talking specifically about WHM/cPanel here) will automatically add domain.com as local on Machine B. This means that when your scripts (or WordPress blog) running on Machine B try to send email to domain.com, it will get stuck on Machine B and never arrive on Machine A.

To avoid this, simply edit your localdomains and remotedomains files on Machine B:

/etc/localdomains
Here you’ll have to remove the domain.com entry. Just remove the whole line it’s on.

/etc/remotedomains
Here you’ll need to add domain.com as an entry. Just add the domain on a line by itself.

And that’s it. =)

Leave a Reply

You must be logged in to post a comment.