没有任何身份验证模块的 Apache

没有任何身份验证模块的 Apache

我不需要 apache2.4 上的身份验证/授权模块,因此我继续注释掉所有 Auth 模块和所有Require指令。

服务器运行正常,但500所有东西都出错了。日志显示

AH00025: configuration error:  couldn't check user: /<path-requested>

每次提到这个错误都只是重复“启用 mod_authz_core.so”。甚至不能寻找源中的错误。

文档说“如果你的网站上有敏感信息或只供一小部分人查看的信息,本文中的技术将帮助你确保看到这些页面的人就是你希望看到的人。”但忽略了你没有敏感信息的情况:)

这是已安装模块的列表

Compiled in modules:
  core.c
  mod_so.c
  http_core.c

这是我的配置文件(带有mod_authz_core+Require注释,以显示我必须添加到“解决方法”中的内容):

ServerRoot "/etc/httpd"

Listen 8000

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
    StartServers             5
    MinSpareServers          5
    MaxSpareServers         10
    MaxRequestWorkers      250
    MaxConnectionsPerChild   0

#LoadModule authz_core_module modules/mod_authz_core.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule log_config_module modules/mod_log_config.so
  ErrorLog "/var/log/httpd/error_log"
  LogLevel warn
  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  LogFormat "%h %l %u %t \"%r\" %>s %b" common
  CustomLog "/var/log/httpd/access_log" common

LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule unixd_module modules/mod_unixd.so
  User http
  Group http

LoadModule status_module modules/mod_status.so
<Location "/status">
    SetHandler server-status
</Location>

LoadModule dir_module modules/mod_dir.so
  DirectoryIndex index.html
  DirectorySlash Off

LoadModule php7_module modules/libphp7.so

ServerAdmin [email protected]
ServerName localhost:8000

<Directory />
    AllowOverride none
    #Require all denied
</Directory>

DocumentRoot "/srv/http"
<Directory "/srv/http">
    <FilesMatch "\.html$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    Options -Indexes -FollowSymLinks
    #Require all granted
</Directory>

Timeout 60
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
UseCanonicalName On
AccessFileName off
ServerTokens Full
ServerSignature Off
HostnameLookups Off

以下是一个示例会话:

$ apachectl configtest
Syntax OK

$ sudo sudo -u http cat /srv/http/index.html
(make sure http user can access the files, all OK)

$ sudo systemctl restart httpd

$ tail -f -c0 /var/log/httpd/*

现在我请求/index.html……

==> /var/log/httpd/error_log <==
[datetime] [core:crit] [pid 3978] [client ip:62758] AH00025: configuration error:  couldn't check user: /index.html

==> /var/log/httpd/access_log <==
ip - - [datetime] "GET /index.html HTTP/1.1" 500 528

==> /var/log/httpd/error_log <==
[datetime] [core:crit] [pid 3975] [client ip:62759] AH00025: configuration error:  couldn't check user: /favicon.ico

==> /var/log/httpd/access_log <==
ip - - [datetime] "GET /favicon.ico HTTP/1.1" 500 528

相关内容