LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 927|回复: 4

Apache基于名称的虚拟主机的问题。

[复制链接]
发表于 2006-3-13 12:21:41 | 显示全部楼层 |阅读模式
我刚开始学习Apache,看了这里虚拟主机配置的帖子,可不知道什么原因,还是做不好。httpd.conf如下:

ServerName niulei

DocumentRoot "/var/www/html"


NameVirtualHost 192.168.1.147
<VirtualHost 192.168.1.147>
        DocumentRoot /home/test1/html/
        ServerName test1.niulei.com
        DirectoryIndex index.html index.htm index.shtml
</VirtualHost>
<VirtualHost 192.168.1.147>
        DocumentRoot /home/test2/html/
        ServerName test2.niulei.com
        DirectoryIndex index.html index.htm index.shtml
</VirtualHost>



DNS里面已经加入了相应的条目,是可以正确解析的。
请明白的兄弟指点一下,谢谢了!
发表于 2006-3-13 16:48:51 | 显示全部楼层
DocumentRoot "/var/www/html"

改成/home
回复 支持 反对

使用道具 举报

发表于 2006-3-13 16:49:47 | 显示全部楼层

apache

DocumentRoot "/var/www/html"改成/home

说明下,虚拟机必须在同一目录下
/home/test1
/home/test2
/root/test3则不能访问

如果客户端直接用IP(127.0.0.1)访问web,默认是/home/test1
具体自己实验一下,自己摸索的比别人教的更实在
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-3-14 11:21:37 | 显示全部楼层
谢谢大哥,我去试一下。
回复 支持 反对

使用道具 举报

发表于 2006-3-14 20:06:03 | 显示全部楼层
Post by jinyongsun
DocumentRoot "/var/www/html"

改成/home
绝不赞成把 DocumentRoot 改成 /home !:beat 你的 Apache 一旦受到攻击,你的 /home 便完旦了!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表