Steps to setting a sub domain for a web service

Published: Wednesday, Dec 26, 2007 Last modified: Monday, Apr 8, 2024

First you need to setup you subdomain with your domain name server:

hendry@bilbo:/etc/apache$ cat /etc/maradns/dabase

# This is what is known as a SOA record.  All zone files need to have one

# of these

S%|86400|%|hostmaster@%|19771108|7200|3600|604800|1800

# These are known as authoritative NS records.  All zone files need one or

# more of these

N%|86400|ns1.%

# An 'IN MX' record

@%|86400|10|mx.%

# Some IP addresses

Ans1.%|86400|194.100.133.7

A%|86400|194.100.133.7

Amx.%|86400|194.100.133.7

Awww.%|86400|194.100.133.7

Awiki.%|86400|194.100.133.7

Amail.%|86400|194.100.133.7

Aaat.%|86400|194.100.133.7

Arobots.%|86400|194.100.133.7

Amprobots.%|86400|194.100.133.7

Ar.%|86400|194.100.133.7

Amedia.%|86400|194.100.133.7

I just added “media” here. Now the apache configuration:

hendry@bilbo:/etc/apache$ cat conf/media.dabase.com.conf

CustomLog /var/log/apache/media.dabase.com-access_log combined

ServerAdmin media@dabase.com

ServerName media.dabase.com

DocumentRoot /web/media.dabase.com/media.py

<Directory “/web/media.dabase.com”> Options All AllowOverride All Order allow,deny Allow from all Now we need to tell apache’s main httpd.conf :

<VirtualHost media.dabase.com>
Include conf/media.dabase.com.conf

</VirtualHost>

The I usually link from /web to my project svn directory:

hendry@bilbo:/web$ ln -s /home/hendry/projects/media/ media.dabase.com

hendry@bilbo:/web$ ll

total 40

drwxr-xr-x   10 hendry   root         4096 2004-04-08 09:19 .

drwxr-xr-x   23 root     root         4096 2004-04-04 23:55 ..

lrwxrwxr-x    1 hendry   hendry         27 2004-02-20 23:57 aat.dabase.com -> /home/hendry/projects/abbr/

drwxrwxr-x    2 hendry   hendry       4096 2004-04-05 16:15 dabase.com

lrwxrwxr-x    1 hendry   hendry         30 2004-04-04 16:19 daidalos.pannuhuone.org -> /home/hendry/projects/mprobots

lrwxrwxr-x    1 hendry   hendry         28 2004-04-08 09:19 media.dabase.com -> /home/hendry/projects/media/

lrwxrwxr-x    1 hendry   hendry         31 2004-04-04 16:09 mprobots.dabase.com -> /home/hendry/projects/mprobots/

One last step. Reload your services !

hendry@bilbo:/web$ sudo /etc/init.d/maradns restart

Restarting maradns: Stopping maradns: maradns.

Starting maradns: maradns.

hendry@bilbo:/web$ sudo /etc/init.d/apache reload

Reloading apache configuration.

You might need to check your permissions …