apache - Apache 设置:指令需要额外的参数
问题描述
我正在尝试在 macOS 上使用 Apache(仅限本地主机)。当我这样做时,apachectl configtest
我得到以下响应:
AH00526: Syntax error on line 238 of /private/etc/apache2/httpd.conf:
<Directory> directive requires additional arguments
httpd.conf 文件的对应部分是
DocumentRoot ~/Sites
<Directory />
Options Indexes SymLinks
MultiviewsMatch Any
AllowOverride None
Require all granted
</Directory>
我查阅了几个论坛/Apache 文档,但我看不到错误。有谁知道如何解决这个问题?
解决方案
通过编写<Directory />
,您是在告诉 Apache Directory 标签会立即关闭。所以你放的配置相当于
<Directory>
</Directory>
Options Indexes SymLinks
MultiviewsMatch Any
AllowOverride None
Require all granted
</Directory>
因为“/>”终止了“<Directory”标签。
以这种方式修改它:
<Directory "/">
Options Indexes SymLinks
MultiviewsMatch Any
AllowOverride None
Require all granted
</Directory>
请注意,“/”将是您机器的“/”。因此,您正在通过 Apache 授予对系统上“/”的访问权限...
推荐阅读
- r - 如何对 R 中的 73 个变量进行夏皮罗威尔克斯测试
- c - 为什么 select() 有时会连续返回 0
- react-native - React native:Error:Location ..... 不可移动
- firebase - Firebase 存储设置速率限制
- javascript - WooCommerce:停止滚动到结帐页面上的错误消息
- java - 使用 mongodb 在 Java Spring 中进行国际化
- fonts - latex:公式中统一的字体大小(给定大小的字体),与公式内容无关
- jquery - Wordpress 联系表 7 比较日期
- python - 如何在 django 中使用 python 脚本?
- c# - 使用 roslyn 提取被调用的方法信息