Apache 设置:指令需要额外的参数
Apache setup: directive requires additional arguments
我正在尝试在 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 "/">
Options Indexes SymLinks
MultiviewsMatch Any
AllowOverride None
Require all granted
</Directory>
请注意,“/”将是您机器的“/”。因此,您正在通过 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>
因为“/>”终止了“ 这样修改: 请注意,“/”将是您机器的“/”。因此,您正在通过 Apache 授予对系统上“/”的访问权限...<Directory "/">
Options Indexes SymLinks
MultiviewsMatch Any
AllowOverride None
Require all granted
</Directory>