如何修复此虚拟主机设置? [英] How to fix this virtual host setup?
本文介绍了如何修复此虚拟主机设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#< p>我已经设置了2个虚拟主机,它们在运行apache 2的centos服务器上共享相同的IP。 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>
无论我指向哪个网址。网站A显示。
如何解决?我应该有a.com去a和b.com去b。
感谢所有
解决方案
是否在您的httpd.conf中设置以下内容?
NameVirtualHost *
文档:
NameVirtualHost *
< VirtualHost *>
ServerName www.domain.tld
DocumentRoot / www / domain
< / VirtualHost>
ServerName www.otherdomain.tld
DocumentRoot / www / otherdomain
< / VirtualHost>
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>
Regardless of what URL I point to. Site A shows up.
How can I fix? I should have a.com going to a and b.com going to b.
Thanks all
解决方案
Is the following set in your httpd.conf?
NameVirtualHost *
An example from the documentation:
NameVirtualHost *
<VirtualHost *>
ServerName www.domain.tld
DocumentRoot /www/domain
</VirtualHost>
<VirtualHost *>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>
这篇关于如何修复此虚拟主机设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文