首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >命令'DirectoryIndex‘无效

命令'DirectoryIndex‘无效
EN

Stack Overflow用户
提问于 2020-12-30 00:56:21
回答 1查看 562关注 0票数 0

我正在运行Apache2.4的全新安装,是通过自制软件安装的。一切似乎都在文档根目录下正常工作,本地主机显示了我的示例html页面,并且info.php呈现得很好。当我试图访问根目录中的一个开发站点时,我得到了500Internal Server Error,并在apache错误日志中看到了这条消息:Invalid command 'DirectoryIndex', perhaps misspelled or defined by a module not included in the server configuration。这似乎来自于我的站点.htaccess文件中的directoryIndex声明。删除它可以消除错误,但随后站点将显示为目录索引,而不是尝试呈现实际的index.php文件。

我的httpd配置如下所示

代码语言:javascript
复制
DocumentRoot "/Path/To/My/Doc/Root"
<Directory "Path/To/My/Doc/Root">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks MultiViews

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All
    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

我假设问题出在httpd.conf文件中,但还没有找到真正的原因。据我所知,应该启用的所有模块都是,并且配置文件通过了语法验证。任何关于如何弄清楚这一点的建议都将非常感谢,我正在用我的头撞在桌子上。

EN

回答 1

Stack Overflow用户

发布于 2020-12-31 00:58:04

确保在conf.modules.d/00-base.conf文件中加载了mod_dir。

代码语言:javascript
复制
LoadModule dir_module modules/mod_dir.so
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65495788

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档