- 论坛徽章:
- 5
|
5可用积分
有个问题困扰我几天了,一直没解决,现在讲一下,希望大家可以帮忙解决一下!
问题是这样的:我安装好apache ,想配置基于IP地址的虚拟主机,其实也就是做好几个网站,然后可以用不同的IP访问不同的网站。
我知道是在/etc/http/conf/httpd.conf里加入
<virtualhost ip 地址>
documentroot 路径
directoryindex 文件名
</virtualhost>
我举个例子:我在根目录下建一个web 目录,然后依次在web目录下建了web1 web2 目录,然后把网站放在web1 web2 中,我想就192.168.1.4来访问web1 网站,用192.168.1.5来访问web2 网站:
<virtualhost 192.168.1.4>
documentroot /web/web1
directoryindex index.html
</virtualhost>
<virtualhost 192.168.1.5>
documentroot /web/web2
directoryindex index.html
</virtualhost>
我就这样配置的httpd.conf文件的,可是我在xp 里去访问,就是访问不到,希望知道的能帮忙解决一下,谢谢!!! |
最佳答案
查看完整内容
documentroot /web/web1directoryindex index.htmldocumentroot /web/web2directoryindex index.html这样可以吗?贴一下我的:我的系统是RHEL5/CentOS5的,默认SELinux是enforcing模式,这时是无法访问的,可以:修改/etc/selinux/config的SELINUX=permissive或disabled(须重启机子);或者chcon -R httpd_sys_content_t /web测试的话,就更简单了,如果是windows客户机,修改C:\WINDOWS\system32\drivers\etc\hosts添加1 ...
|