阿帕奇虚拟主机

发布于 2024-10-15 12:10:08 字数 852 浏览 5 评论 0原文

我正在尝试设置我的 VPS 来托管两个域。 httpd.conf 的虚拟主机部分如下:

<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/">
    allow from all
    Options +Indexes
</Directory>
</VirtualHost>

但是,当我在浏览器中输入域时,两者都会解析到同一站点(httpd.conf 文件中第一个站点)。上面的内容有明显的错误吗?

除此之外,当我注册这两个域名时,我还注册了两组名称服务器(ns1/ns2.siteA.com & ns1/ns2.siteB.com),并且两者的IP地址相同,如下所示我目前只有一个 IP 地址。这也可能是一个问题吗?我不认为是这样,但它可能值得一提。

其他信息:在 Centos 4 上运行的 Apache 2.2.3。使用命令行编辑(大部分)和 Webmin 1.5 的混合来控制 VPS。

有什么想法吗? 谢谢!

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/">
    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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

残龙傲雪 2024-10-22 12:10:08

添加

 NameVirtualHost www.siteA.com
 NameVirtualHost www.siteB.com

到食谱中。来自参考

如果要配置,NameVirtualHost 指令是必需的指令
基于名称的虚拟主机。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文