虚拟主机多个站点,Apache的Linux服务器 [英] virtualhost multiple sites, apache linux server

查看:132
本文介绍了虚拟主机多个站点,Apache的Linux服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,如果这听起来很愚蠢,我的感觉如何,因为我已经做到了这一点,在过去并不能弄清楚什么是错。

Sorry if this sounds stupid, its how I feel since I've done this in the past and can't figure out whats wrong.

不管怎么说,我对我的Fedora Linux系统盒两个站点的设置,现在我想添加第三个站点。然而,当我去www.site3.com它被重定向到第一个站点。

Anyways, I had two sites setup on my fedora linux box, now I'm trying to add a third site. However when I go to www.site3.com it gets redirected to the first site.

我的虚拟主机code是非常基本的,请让我知道什么我应该加入,你可以看到这导致我提到这个问题的任何问题。

My VirtualHost code is very basic, please let me know what else I should be adding and any issues you can see which result to the issue I mentioned.

httpd.conf中:

httpd.conf:

<VirtualHost *:80>
   DocumentRoot /var/www/html/web/site1/
   ServerName site.com
</VirtualHost>
<VirtualHost *:80>
   DocumentRoot /var/www/html/web/site2/
   ServerName site2.com
</VirtualHost>
<VirtualHost *:80>
   DocumentRoot /var/www/html/web/site3/
   ServerName site3.com
</VirtualHost>

还有什么我需要比这个更改其他?另外前两个站点仍然做工精细,我已经重新启动httpd服务,但无济于事。

Is there anything else I need to change other than this? The other first two sites still work fine, I've restarted the httpd service, but no avail

在此先感谢

推荐答案

www.site3.com site3.com 是不一样的主机名。请参阅 ServerAlias​​指令

www.site3.com and site3.com are not the same hostname. See the ServerAlias directive.

<VirtualHost *:80>
   DocumentRoot /var/www/html/web/site3/
   ServerName site3.com
   ServerAlias www.site3.com
</VirtualHost>

这篇关于虚拟主机多个站点,Apache的Linux服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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