【问题标题】:apache not returning index.php as defaultapache默认不返回index.php
【发布时间】:2014-02-18 18:29:56
【问题描述】:

我最近制作了一个预装了 LAMP 的 DigitalOcean 液滴。 将我的网站(包括 index.php)上传到 /var/www

Apache 只返回 It Works!页, 我必须手动将 /index.php 添加到我的网址

我尝试过的事情:

  1. 制作了一个包含“DirectoryIndex index.php”的.htaccess文件
  2. DirectoryIndex index.php 添加到apache2.conf
  3. 在dir.conf中先设置index.php
  4. 制作 index.html,也没有显示。

编辑: 这是我的 apache2.conf 文件:http://pastebin.com/BMgiNdiD

【问题讨论】:

  • 你的 apache2.conf 中有什么?设置了什么目录?此外,您已将 index.PHP 设置为目录索引,因此 .html 页面不会覆盖 php 索引页面

标签: apache lamp digital-ocean directoryindex


【解决方案1】:

您缺少以下配置:

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm \
               default.php default.pl default.cgi default.asp default.shtml default.html \
               default.htm home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>

【讨论】:

    猜你喜欢
    • 2013-02-03
    • 2012-04-27
    • 2011-01-23
    • 2016-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-25
    • 2012-11-03
    相关资源
    最近更新 更多