免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2041 | 回复: 4
打印 上一主题 下一主题

[Web] 问一下apache配置虚拟服务器的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-09-29 17:09 |只看该作者 |倒序浏览
httpd.conf如下:
NameVirtualHost *
<VirtualHost 122.222.222.222>
DocumentRoot /var/www/html/s1

ServerName www.dm1.com

</VirtualHost>

<VirtualHost 122.222.222.222>
DocumentRoot /var/www/html/s2

ServerName www.dm2.com

</VirtualHost>

未设虚拟主机之前用IP访问正常,设完虚拟主机后用service httpd restart重启apache,然后用这两个域名访问的时候,返回的内容都是 /var/www/html/s1的内容,为什么?

论坛徽章:
0
2 [报告]
发表于 2007-10-01 01:58 |只看该作者

是浏览器缓存的问题吧

原帖由 tongj 于 2007-9-29 17:09 发表
httpd.conf如下:
NameVirtualHost *

DocumentRoot /var/www/html/s1

ServerName www.dm1.com




DocumentRoot /var/www/html/s2

ServerName www.dm2.com



未设虚拟主机之前用IP访问正常 ...



试试清缓存吧

论坛徽章:
0
3 [报告]
发表于 2007-10-05 15:12 |只看该作者
与浏览器无关,我在自己机器上清缓存试过不行,在别的机器上也不行,都是一样的结果

论坛徽章:
0
4 [报告]
发表于 2007-10-05 18:07 |只看该作者
用apachectl configtest 试了一下,好像是说我的<VirtualHost>的端口和NameVirtualHost的设置不一致,现在改成:

NameVirtualHost *:80
<VirtualHost *.80>
DocumentRoot /var/www/html/s1

ServerName www.dm1.com

</VirtualHost>

<VirtualHost *.80>
DocumentRoot /var/www/html/s2

ServerName www.dm2.com

</VirtualHost>

就好了.不知道是不是端口的原因

论坛徽章:
0
5 [报告]
发表于 2007-10-10 15:12 |只看该作者
NameVirtualHost *是不行的
必须要用
NameVirtualHost *80
也就是你后来正确的那个模式
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP