Was this page helpful?

Setting up a subdomain in Apache

    Table of contents
    No headers

     The walkthrough below explains how to add a new forums subdomain.  Refer here for information on setting up virtual hosts with Apache. 

    Note: The steps below follow some Debian conventions.

    1. Make sure you have the following at the very top of one of your apache config files (example:  /etc/apache2/sites-available/deki)

    NameVirtualHost *

    2. Create a new virtual host configuration file under /etc/apache2/sites-available:

    <VirtualHost *>
            ServerName forums.myserver
    
            ErrorLog /var/log/apache2/error.log
            CustomLog /var/log/apache2/access.log common
    
            DocumentRoot "/var/www/forum"
    </VirtualHost>

    3. create a symlink to sites-enabled

    Code:
    ln -s /etc/apache2/sites-available/<configFileName> /etc/apache2/sites-enabled/<configFileName>

    Note: if you'd like the config files to be loaded in a specific order, create the symlink like this:

    ln -s /etc/apache2/sites-available/forums /etc/apache2/sites-enabled/001-forums
    ln -s /etc/apache2/sites-available/blog /etc/apache2/sites-enabled/002-blog

    In this case, the forums VirtualHost will be processed before the blog VirtualHost

    4. reload apache

    Code:
    /etc/init.d/apache2 force-reload

    5. add the DNS entry for forums.<servername>

      

    Was this page helpful?
    Tag page
    Viewing 1 of 1 comments: view all
    I gave this a go but failed, I think the trick missing from the above is the following? I don't know which *.conf file to stick it in, can you let us know where yours is?

    # Listen for virtual host requests on all IP addresses
    NameVirtualHost *:80
    Posted 14:35, 28 Oct 2007
    Viewing 1 of 1 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by