I'm trying to set up my VPS to host two domains. The virtual host section of the httpd.conf is as follows:
<VirtualHost www.siteA.com>
DocumentRoot /home/XXXXX/public_html/siteA
ServerName www.siteA.com
<Directory "/home/XXXXX/public_html/siteA">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost www.siteb.com>
DocumentRoot /home/XXXXX/public_html/siteb/
<Directory "/home/XXXXX/public_html/siteb/">开发者_C百科;
allow from all
Options +Indexes
</Directory>
</VirtualHost>
However when I enter the domains into a browser, both resolve to the same site ( to the site that is first in the httpd.conf file). Is there anything obviously wrong with the above?
Aside from this, when I registered the two domain names, I also registered two sets of nameservers (ns1/ns2.siteA.com & ns1/ns2.siteB.com) and the IP address of both of these are the same, as I currently only have a single IP address. Could this also be a problem? I don't think it is, but its probably worth mentioning.
Other info: Apache 2.2.3 running on Centos 4. Using a mixture of command line editing (mostly) and Webmin 1.5 to control the VPS.
Any thoughts? Thanks!
Add
NameVirtualHost www.siteA.com
NameVirtualHost www.siteB.com
to the recipe. From the reference:
The NameVirtualHost directive is a required directive if you want to configure name-based virtual hosts.
精彩评论