Setting up sackhosted virtual domains |
---|
Register the domain, wait a day
If the domain isn't already registered, you'll want to take care of that.
See sackdns. Whether it's registered
or not, you'll want to make sure its nameservers are set to:
sjc.nameserver.net # haybaler
phl.nameserver.net # baconhouse
sou.nameserver.net # joshua
You can optionally also add:
But that's up to you. Wait a day, for the information to make its way into
the root nameservers, and the other steps can be performed.
Next, go to
This information is imported into our dns configuration and propogated
amongst the nameserver.net machines every half hour -- you don't need
to do anything else for DNS, just wait a few minutes. Don't try any lookups
in this period, since a negative response will be cached by your local
nameserver for a while.
These all should be pretty obvious as well. The one requirement in
On the boxes you designated as backup MXes, you'll want to add your domain
to
This should take care of virtual users- postfix will deliver their mail to the
appropriate place, and courier will let them retrieve it.
Next, edit
Then, create the docroot:
Finally, restart apache:
You can populate the docroot directory with your web content with your own
regular userid.
That should do it. It ain't exactly simple, but it's not hard either. :-)
rdu.nameserver.net # pound.ifndef.com
bos.nameserver.net # bos.priori.net
iad.nameserver.net
Set up DNS
First, we'll want to set up the master nameserver. Most of our zones are
on haybaler at the moment, though we'd like to move them to baconhouse. Best
practice is currently to set new domains up on bacon. You'll want to copy
/etc/namedb/primary/empty.zone
to
/etc/namedb/primary/yourdomain.tld
and edit it appropriately:
add A, CNAME, MX, and NS records here. See other zone files for examples.
The most common case would be to list haybaler as the primary (lowest-numbered)
MX, baconhouse second, and joshua third. Please don't list any of the
non-sack nameserver.net machines as backup MXes, they won't accept your mail.
[Note: On baler, the zone files are located in
/usr/local/dns/primary
for legacy reasons.]/usr/local/SackConfig
and edit phl.conf
(or sjc.conf
, or whatever machine you're on.) The format here
should be obvious: add master/slave lines for each nameserver.net machine
you indicated would be serving up DNS for your domain.Configure basic mail delivery
Once DNS is working (try nslookup www.hostname.tld
) you can
move on to basic mail configuration. On haybaler,
virtual
is that postmaster
and abuse
for your domains go to the correct role accounts for wherever the mail is
going. For locally-delivered mail, that is 'postmaster' and 'abuse',
respectively. You can trap all mail to your domains otherwise with the
following syntax:
@mydomain.tld myuserid
relaydomains
, but don't mess with anything else. On baconhouse,
this is simply a statement in main.cf
.
Set up IMAP virtual users
If you want to set up virtual IMAP mailboxes, do the following for each
userid:
mkdir /var/spool/maildirs/user@mydomain.tld
maildirmake /var/spool/maildirs/user@mydomain.tld/Maildir
chown -R virtimap /var/spool/maildirs/user@mydomain.tld
chgrp -R mail /var/spool/maildirs/user@mydomain.tld
chmod 770 /var/spool/maildirs/user@mydomain.tld
/usr/local/etc/postfix/virtual
:
user@mydomain.tld virtimap
and run postmap /usr/local/etc/postfix/virtual
and
postfix reload
~virtimap/.procmailrc
and add a stanza for
your new user matching those that you see in the file.
userdb "user@mydomain.tld" set home=/home/virtimap \
mail=/var/spool/maildirs/user@mydomain.tld/Maildir \
uid=993 gid=993
userdbpw | userdb "user@mydomain.tld" set imappw
makeuserdb
Configure apache
If you want to serve web pages for this domain from our box, you should have
created a www
A record in your zone file in the DNS section, and
pointed it to baler. A blank A record will also let it respond to "mydomain.tld"
without the "www.", which is quite nice./usr/local/etc/apache2/httpd.conf
and find the
VirtualDomain sections. Scroll down to the bottom and copy a a random one,
edit it to taste. You can use the ServerName and ServerAlias directives to
have multiple names for this one stanza ("mydomain.tld", "www.mydomain.tld",
etc.) Please make the log directive place the logs in
/var/log/httpd/mydomain.tld/
. You will need to create that
directory as well (mkdir /var/log/httpd/mydomain.tld
).
mkdir /home/httpd/html/mydomain.tld
chown yourid /home/httpd/html/mydomain.tld
chgrp web /home/httpd/html/mydomain.tld
apachectl restart