centos,apache虚拟主机配置,配置之后不正常,请求高手指点
时间:2010-12-03
来源:互联网
使用centos,这是apache配置文件(httpd.conf):
NameVirtualHost 123.321.123.321
<VirtualHost *:80>
DocumentRoot /var/www/html/host1
ServerName host1.com
<Directory "/var/www/html/host1">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/host2"
ServerName host2.com
<Directory "/var/www/host2">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
用上面的方法配置了两个虚拟主机,重启apache,就出现这样的情况:
访问http://123.321.123.321,host1.com,host2.com,指向的都是这一个目录:/var/www/html/host1。我的本意当然是让不同的域名指向不同的目录。
请问这可能是什么原因呀?
已经凌晨两点多了,还是没弄好,求高人指点,多谢,多谢,非常感谢!!!!!!
NameVirtualHost 123.321.123.321
<VirtualHost *:80>
DocumentRoot /var/www/html/host1
ServerName host1.com
<Directory "/var/www/html/host1">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/host2"
ServerName host2.com
<Directory "/var/www/host2">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
用上面的方法配置了两个虚拟主机,重启apache,就出现这样的情况:
访问http://123.321.123.321,host1.com,host2.com,指向的都是这一个目录:/var/www/html/host1。我的本意当然是让不同的域名指向不同的目录。
请问这可能是什么原因呀?
已经凌晨两点多了,还是没弄好,求高人指点,多谢,多谢,非常感谢!!!!!!
作者: coocoo321 发布时间: 2010-12-03
楼主,配置虚拟主机写法是没错的,你检查把http.conf里面的其它的DocumentRoot 这些地方注释起来,还有配置hosts没有。你再这样写试试看,<VirtualHost host1.com:80><VirtualHost host2.com:80>。。争取早点成功哈!
作者: zyujie 发布时间: 2010-12-03
<Directory "/var/www/html/host1">
allow from all
Options +Indexes
</Directory>
<Directory "/var/www/host2">
allow from all
Options +Indexes
</Directory>
这两个都可以去掉
allow from all
Options +Indexes
</Directory>
<Directory "/var/www/host2">
allow from all
Options +Indexes
</Directory>
这两个都可以去掉
作者: xming4321 发布时间: 2010-12-03
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28