我在 Ubuntu 20.04 上运行 Apache 2.4.41 并且无法在我的 VirtualHost 上获得任何 Require 指令。作为一个最低限度的工作示例,我的 VHost 文件:
<VirtualHost *:80>
ServerName my.domain.com
DocumentRoot "/var/www/html/admin"
<Directory /var/www/html/admin>
Require all denied
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
旨在阻止所有访问,但日志显示:
[authz_core:debug] [pid 340724] mod_authz_core.c(735): [client ***.***.***.***:59008] AH01625: authorization result of <RequireAny>: granted (directive limited to other methods)
我在 Apache 配置树的其他地方看不到任何对 Require 行为的覆盖。例如,/etc/apache2/apache.conf
包含:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
</Directory>
我加载的模块是:
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
headers_module (shared)
mime_module (shared)
mpm_prefork_module (shared)
negotiation_module (shared)
php7_module (shared)
proxy_module (shared)
proxy_http_module (shared)
remoteip_module (shared)
reqtimeout_module (shared)
rewrite_module (shared)
setenvif_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)
apachectl -t
并apachectl -S
给出标准输出。
有人对我接下来应该去哪里有任何想法吗?
(提醒:Apache 2.4 不是 Apache 2.2 所以希望使用当前的术语)