AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1089331
Accepted
MartinV
MartinV
Asked: 2022-01-08 08:52:41 +0800 CST2022-01-08 08:52:41 +0800 CST 2022-01-08 08:52:41 +0800 CST

Apache 2.4:要求(例如全部被拒绝)指令未得到遵守

  • 772

我在 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 所以希望使用当前的术语)

virtualhost apache-2.4 ubuntu-20.04
  • 1 1 个回答
  • 190 Views

1 个回答

  • Voted
  1. Best Answer
    MartinV
    2022-01-09T05:17:15+08:002022-01-09T05:17:15+08:00

    感谢所有阅读我的问题的人 - 我找到了一个解决方案并认为我会分享它。

    我将 Apache2 树移到一侧并从存储库重新安装了相关软件包。Require 指令套件现在再次起作用,因此我比较了新旧树以找出差异。

    我发现了一个晦涩的指令,其中包含我放置在启用 conf 的目录中的 Require all 命令,结果证明这是问题的原因。

    因此,如果 Apache 指令存在问题,值得检查的不仅仅是 apache2.conf 和 vhosts 目录——还要检查 conf 和 mods 目录!

    干杯

    • 0

相关问题

  • 阿帕奇虚拟主机

  • Apache:对多个虚拟主机使用相同的目录指令

  • Apache 中的动态虚拟主机

  • VirtualHost / NameVirtualHost 背后的逻辑是什么

  • 如何设置 Jetty 6 和 Jboss 4.0.5 虚拟主机?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve