[plug] Apache Server Alias

Steve Baker steve at iinet.net.au
Wed May 7 14:24:39 WST 2008


skribe productions wrote:
> On Wed, May 7, 2008 at 1:57 PM, Steve Baker <steve at iinet.net.au> wrote:
>   
>> Have you put the vhost for the media site before the vhost with the
>> catchall?
>>     
> No.  I'm trying to work out how to do it
In that case:

You need to create 'virtual hosts' or vhosts under your apache 
configuration.  Under each vhost put in the ServerName and any other 
ServerAliases that you want that vhost to respond to.

Using the configuration below, the second vhost will use the /var/media 
directory and will be picked up by apache when any of 'media',  
'media.myname.com' or 'othername.myname.com' are used in the browser.  
The first vhost should pick up any other names that route to your 
webserver.  Note that your config options under the 'Directory' level 
might be different to those shown

Regards,
Steve


NameVirtualHost *

<VirtualHost *>
        ServerAdmin webmaster at localhost

        DocumentRoot /var/www/
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
   (other config options...)
</VirtualHost>


<VirtualHost *>
        ServerName media
        ServerAlias media.myname.com othername.myname.com
        ServerAdmin webmaster at localhost

        DocumentRoot /var/media/
        <Directory /var/media/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
   (other config options...)
</VirtualHost>




More information about the plug mailing list