Setting up subdomain with Apache2

Discussion in 'Apache' started by kx2, Sep 16, 2007.

  1. #1
    I got a little problem setting up subdomain in apache...

    on my domain registrar (namecheap) I set up CNAME for my subdomain to be : forum.mydomain.com.

    In my apache config file ("default") I put :

    NameVirtualHost *

    <VirtualHost *>
    ServerAdmin
    ServerName forum.mydomain.com

    DocumentRoot /var/www/sforum/

    <Directory /var/www/sforum/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    </Directory>

    </VirtualHost>

    <VirtualHost *>
    ServerAdmin
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /var/www/

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

    ErrorLog /var/log/apache2/error.log

    CustomLog /var/log/apache2/access.log cplus
    ServerSignature On
    </VirtualHost>

    the thing is when I go to forum.mydomain.com it redirects me to www.mydomain.com

    any ideas how to make it work?

    Thanks in advance.
     
    kx2, Sep 16, 2007 IP
  2. nick-a

    nick-a Active Member

    Messages:
    446
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    #2
    I think you might want an A name, and it looks like you have wildcard dns enabled, which you dont want.

    Also, don't use the * in the vhost directive.
     
    nick-a, Sep 26, 2007 IP