如何解决这个虚拟主机设置? [英] How to fix this virtual host setup?

查看:134
本文介绍了如何解决这个虚拟主机设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我共享同一个IP上运行的Apache 2 CentOS的服务器上安装了2虚拟​​主机。

I have setup up 2 virtual hosts that share the same IP on a centos server running apache 2.

#<VirtualHost *:80>
#    ServerAdmin webmaster@dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /var/www/a
    ServerName www.a.com
    ServerAlias a.com
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /var/www/b
    ServerName www.b.com
    ServerAlias b.com
</VirtualHost>

不管我点什么URL。站点A显示了。

Regardless of what URL I point to. Site A shows up.

我该如何解决?我应该有a.com去一个和b.com去到b。

How can I fix? I should have a.com going to a and b.com going to b.

感谢所有

推荐答案

是以下在httpd.conf设置?

Is the following set in your httpd.conf?

NameVirtualHost *

文档一个例子:

NameVirtualHost *

<VirtualHost *>
ServerName www.domain.tld
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost *>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>

这篇关于如何解决这个虚拟主机设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆