Re: [Hampshire] aliasing domains in Debian Apache2

Top Page

Reply to this message
Author: Dr A. J. Trickett
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] aliasing domains in Debian Apache2
John,

> Many tips I found by searching the web assume use of the
> /etc/apache2/httpd.conf file but debian doesn't use this by default.
>
> Suggestions would be welcome please.


Basically the best option for three sites "A", "B" and "C" is to use Apache2
standard virtual hosting feature.

1) You get your domain registrar to point the web sites you want all at the
same Apache server. So if you ping A, B or C you get the same machine and IP
address.

2) You then create virtual sites inside the /etc/apache2/sites-available
directory. Here is one I created earlier (file is called i2):

<VirtualHost *:80>
        ServerName i2.iredale.net
        ServerAlias i2                                                                                                                                       


        ServerAdmin adam.trickett@???                                                                                                                


        DocumentRoot /srv/www/i2                                                                                                                             
        <Directory /srv/www/i2/>                                                                                                                             
                Options Indexes FollowSymLinks MultiViews                                                                                                    
                AllowOverride All                                                                                                                            
                Order allow,deny                                                                                                                             
                allow from all                                                                                                                               
        </Directory>                                                                                                                                         


        ErrorLog /var/log/apache2/i2/error.log                                                                                                               
        LogLevel warn


        CustomLog /var/log/apache2/i2/access.log combined
        ServerSignature On


        Alias /icons/ "/usr/share/apache2/icons/"
        <Directory "/usr/share/apache2/icons">
            Options Indexes MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
</VirtualHost>


What this says create a virtual site called "i2.iredale.net" and sets it's
document root as /srv/www/i2

It's also sets up it's own logging and pulls in the standard Apache icons
library.

Once that is done you need to enable it:

sudo a2ensite i2

Which builds the links of this file into the /etc/apache2/sites-enabled
directory, then you restart Apache and you are done:

sudo apache2ctl restart

Or at least that is how I've done it on my Debian boxes in the past.

--
Adam Trickett
Overton, HANTS, UK

A bank is a place where they lend you an umbrella in fair
weather and ask for it back when it begins to rain.
    --  Robert Frost