I'm trying to set up different domains on my vps server. The server has one ip-address and a DNS name on which it resolves.

I have created a virtual host through Webmin and configured my website for this user. Everything is working fine, except that when I add another virtualhost, I keep being redirected to the first virtualhost.

To make things a bit clearer, I have included my httpd.conf file:

ServerAdmin root@localhost
ServerName hyper.vps.domain.nl
UseCanonicalName Off
DocumentRoot "/var/www/html"
<Directory />
    Options FollowSymLinks
    AllowOverride All
</Directory>
<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<IfModule mod_userdir.c>
    UserDir public_html
</IfModule>
<VirtualHost *>
DocumentRoot /home/domain2/public_html
ServerName test.domain2.nl
<Directory /home/domain2/public_html>
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *>
DocumentRoot "/home/domain3/public_html"
ServerName shop.domain3.nl
<Directory "/home/domain3/public_html">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

Any help would be more than appreciated, especially as I'm quite new around here.

link|improve this question
feedback

migrated from stackoverflow.com Oct 12 '11 at 13:19

This question came from our site for professional and enthusiast programmers.

1 Answer

You will need a

NameVirtualHost *

directive - try adding it just before you start declaring the VirtualHost sections

link|improve this answer
Great, thanks so much. This works. – Patrick Steenks Oct 12 '11 at 13:53
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.