apache中怎么配置网站的默认首页

cups_book 发布于 2014/08/06 13:56
阅读 10K+
收藏 0

【开源中国 APP 全新上线】“动弹” 回归、集成大模型对话、畅读技术报告”

apache中怎么配置网站的默认首页呢,documentRoot下有index.php时,默认访问该页。但我想默认访问index.html,怎么办?

1. 我已经在httpd.conf里配了DirecotoryIndex,

DirectoryIndex index.php index.html index.htm index.html.var

2. 并且DocumentRoot下面没有index.php了(我把index.php重命名成了bak_index.php),但浏览器还是显示原来index.php里的内容,我这个index.php里只有一行代码: 

echo 'me run';

为什么不显示我的index.htm呢?

加载中
0
cups_book
cups_book

/etc/httpd/conf/httpd.conf文件里也没有

# Host Configuration
Include conf/hosts.conf



这个可以手工添加吗?

0
cups_book
cups_book
我的/etc/httpd/conf目录下,没有
hosts.conf
0
cups_book
cups_book

现在,我更凌乱了。。。。。
1. 在公司里
1.1 用360访问www.b.com显示www.a.com的内容
1.2 用Firefox访问www.b.com显示早就不存在了的index.php的内容
1.3 用Chrome访问www.b.com显示www.a.com的内容

2. 在家里
2.1 Firefox访问www.b.com显示正常,显示的是index.htm的内容
2.2 用360访问www.b.com显示www.a.com的内容

0
cups_book
cups_book

<VirtualHost www.a.com:80>
     DocumentRoot /data1/www.a.com/docs
     ServerName www.a.com
     <Directory /data1/www.a.com/docs>
     Options FollowSymLinks
     AllowOverride None
     Order deny,allow
     Allow from all
     DirectoryIndex index.php
    </Directory>
 </VirtualHost>

<VirtualHost www.b.com:80>

     DocumentRoot  /data1/ www.b.com/docs
     ServerName   www.b.com
     <Directory  /data1/ www.b.com/docs >
     Options FollowSymLinks
     AllowOverride None
     Order deny,allow
     Allow from all
     DirectoryIndex index.htm
     </Directory>

</VirtualHost>

没有其他的文件,就一个index.htm,刚才把服务器reboot了,现在访问b.com的时候,显示的是a.com的首页。。。

cups_book
cups_book
呵呵,QQ群里一个兄弟跟我说的。。。。
Feng_Yu
Feng_Yu
该评论暂时无法显示,详情咨询 QQ 群:点此入群
0
Feng_Yu
Feng_Yu
DirectoryIndex是首页的查找次序,把index.html放第一位即可
0
cups_book
cups_book
该评论暂时无法显示,详情咨询 QQ 群:点此入群
0
cups_book
cups_book
1.apache 也重起了(service httpd restart)
2.本地浏览器也重启了(IE, FireFox,360, Chrome) 浏览器浏览历史都清空了。
3.本地电脑也重启了。
浏览器还是显示那个已经不存在的index.php的内容 - 我已经把这个文件删除了, documentRoot下面根本就没这个文件。
0
cups_book
cups_book

我先改了全局的DirectoryIndex,似乎没效果。

后来又改了具体的虚拟目录的DirectoryIndex,现在似乎好了。观察ing。。。


0
firstrose
firstrose
浏览器缓存?
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部