开发者

Apache Virtual Hosts

开发者 https://www.devze.com 2023-02-07 19:32 出处:网络
I\'m trying to set up my VPS to host two domains. The virtual host section of the httpd.conf is as follows:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消