Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2007
    Posts
    217
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Virtual hosts and domains

    Hey guys,

    I have a server and want to host multiple domains on it. I've looked around google and apache docs and I need to create Virtual Hosts. So I went ahead and did that but I'm getting a problem.

    I've setup two virtualhosts:

    <VirtualHost 204.12.227.99>
    DocumentRoot /home/ole/public_html
    ServerName wispengine.com
    <Directory /home/ole/public_html>
    allow from all
    Options +Indexes
    </Directory>
    </VirtualHost>

    <VirtualHost 204.12.227.99>
    DocumentRoot /home/ole/public_html/vwc
    ServerName virtualworldscommunity.com
    <Directory "/home/ole/public_html/vwc">
    allow from all
    Options +Indexes
    </Directory>
    </VirtualHost>

    Now wispengine.com works fine, but virtualworldscommunity.com instead of pointing to the subfolder home/ole/public_htm/vwc/ it points to home/ole/public_html like the wispengine.com virtual host.

    Any help?

  • #2
    New Coder
    Join Date
    Dec 2010
    Location
    IA
    Posts
    41
    Thanks
    0
    Thanked 4 Times in 4 Posts
    You would need two different IP addresses for that setup to work. You want to use NameVirtualHost.

    Code:
    NameVirtualHost *:80
    
    <VirtualHost *:80>
    DocumentRoot /home/ole/public_html
    ServerName wispengine.com
    <Directory /home/ole/public_html>
    allow from all
    Options +Indexes
    </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot /home/ole/public_html/vwc
    ServerName virtualworldscommunity.com
    <Directory "/home/ole/public_html/vwc">
    allow from all
    Options +Indexes
    </Directory>
    </VirtualHost>
    or you could just add the line:

    NameVirtualHost 204.12.227.99

    above your virtualhost entries and that should work too...
    Last edited by ecco; 02-28-2011 at 02:25 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •