大网数据广告活动
服务器运维问答

Apache2 "Require all granted" doesn't work

· 52CE 我爱测

I have a fresh install of Apache2 on Debian testing and configured a virtual host in a directory like this: <Directory "/path/to/project"> Options Indexes FollowSymLinks MultiViews AllowOverride All Require all granted </Director…

问题原文

原帖链接 · hairlessdev · CC BY-SA 3.0

I have a fresh install of Apache2 on Debian testing and configured a virtual host in a directory like this:

<Directory "/path/to/project">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
</Directory>

However it shows me a 403 Forbidden error when I access it and the error log shows:

[Mon Sep 23 22:07:57.249276 2013] [authz_core:debug] [pid 8599] mod_authz_core.c(802): [client 127.0.0.1:49057] AH01626: authorization result of Require all denied: denied
[Mon Sep 23 22:07:57.249349 2013] [authz_core:debug] [pid 8599] mod_authz_core.c(802): [client 127.0.0.1:49057] AH01626: authorization result of <RequireAny>: denied
[Mon Sep 23 22:07:57.249361 2013] [authz_core:error] [pid 8599] [client 127.0.0.1:49057] AH01630: client denied by server configuration: /path/to/project/some_file

Why is it showing "result of Require all denied: denied" if I'm using "Require all granted"?

They files are readable by any user and just in case I tried changing the owner to Apache (www-data) without luck. Also, the default host on http://localhost works normally and phpmyadmin in http://localhost/phpmyadmin works too.

All help I've found on the Internet is about replacing the Order directive with Require. I've already done that. What could be the problem now?

社区高分解答

原帖链接 · Doug · CC BY-SA 3.0

Here are two things to try:

1) Run apachectl -t to check the syntax of your file is valid.

2) Run apachectl -S to show which files are being parsed.

For example, you may be editing /usr/local/etc/apache2/2.4/httpd.conf and that's it right? ...but if you run apachectl -S you might see:

VirtualHost configuration:
*:80                   localhost (/private/etc/apache2/extra/httpd-vhosts.conf:23)

ie. The virtual host is overriding your httpd.conf, and may contain its own Require all denied or similar.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-09-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。