我正在运行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配置如下所示
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文件中,但还没有找到真正的原因。据我所知,应该启用的所有模块都是,并且配置文件通过了语法验证。任何关于如何弄清楚这一点的建议都将非常感谢,我正在用我的头撞在桌子上。
发布于 2020-12-31 00:58:04
确保在conf.modules.d/00-base.conf文件中加载了mod_dir。
LoadModule dir_module modules/mod_dir.sohttps://stackoverflow.com/questions/65495788
复制相似问题