[ale] Question about apache virtual hosts

Jim Popovitch jimpop at yahoo.com
Wed Jan 3 11:10:32 EST 2007


On Wed, 2007-01-03 at 10:55 -0500, Jim wrote:
> What I'm trying to do is set up freedns' concept of a subdomain.  I
> think there may be more than one definition.  Anyway I have a freedns
> account and have established a subdomain of sub.maindomain.com which
> points to the same ip as maindomain.com.
> 
> In apache I have the following:
> NameVirtualHost 69.93.127.xxx:80
> 
> <VirtualHost 69.93.127.xxx:80>
>     DocumentRoot /home/k4gvo/public_html/
>     ServerName k4gvo.maindomain.com
>     <Directory /home/k4gvo/public_html/>
>         AllowOverride All
>         Options FollowSymLinks
>         Order allow,deny
>         Allow from All
>     </Directory>
> </VirtualHost>
> 
> What works is when I go to http://k4gvo.maindomain.com I see what I
> expect to see, the web page in k4gvo's public_html directory. 
> 
> What doesn't work is when I go to http://maindomain.com I see the same
> thing, not what is in /var/www.
> 
> What did I miss?
> 

You need at least two VirtualHost sections for 2 different websites:

NameVirtualHost 69.93.127.xxx:80

<VirtualHost 69.93.127.xxx:80>
    DocumentRoot /home/k4gvo/public_html/
    ServerName k4gvo.maindomain.com
    <Directory /home/k4gvo/public_html/>
        AllowOverride All
        Options FollowSymLinks
        Order allow,deny
        Allow from All
    </Directory>
</VirtualHost>

<VirtualHost 69.93.127.xxx:80>
    DocumentRoot /var/www/
    ServerName maindomain.com
    <Directory /var/www/>
        AllowOverride All
        Options FollowSymLinks
        Order allow,deny
        Allow from All
    </Directory>
</VirtualHost>

<VirtualHost 69.93.127.xxx:80>
    ServerAlias *
    Redirect permanent / http://maindomain.com
</VirtualHost>








More information about the Ale mailing list