【问题标题】:URL Authentication Not Working on Apcahe2.4 version with Amazon Linux AMIURL 身份验证在带有 Amazon Linux AMI 的 Apcahe2.4 版本上不起作用
【发布时间】:2020-04-12 03:18:53
【问题描述】:

Apache 2.4 版本配置文件启用了“mod_rewrite”模块。

LoadModule rewrite_module modules/mod_rewrite.so

身份验证模块加载并共享命令的输出:apachectl -M | grep '身份验证'

auth_basic_module (shared)
auth_digest_module (shared)
authn_file_module (shared)
authn_anon_module (shared)
authn_dbm_module (shared)
authz_host_module (shared)
authz_user_module (shared)
authz_owner_module (shared)
authz_groupfile_module (shared)
authz_dbm_module (shared)
authnz_ldap_module (shared)
authz_core_module (shared)

在apache2.4中——Application目录的Web Server配置文件

 <Directory /var/www/html/logfile>
 AllowOverride AuthConfig
 Require all granted
 </Directory>

.htaccess文件放在logfile目录下

AuthType Basic
AuthName "Restricted Access"
AuthBasicProvider file
AuthUserFile "/home/ec2-user/htpasswd/.htpasswd"
Require user tom

通过 url 访问日志文件,必须请求 url 认证,验证成功后才允许查看文件。

但它会生成500 - Internal server Error并共享apache服务器日志

.htaccess:无效命令“AuthType”,可能拼写错误或由未包含在服务器配置中的模块定义

【问题讨论】:

    标签: .htaccess mod-rewrite apache2.4 connect-modrewrite urlauthenticationchallenges


    【解决方案1】:

    需要在 Apache 2.4 上启用以下模块以进行 url 身份验证

    LoadModule authn_core_module modules/mod_authn_core.so
    LoadModule authz_core_module modules/mod_authz_core.so
    

    其他支持模块 - 身份验证相关

    LoadModule authn_file_module modules/mod_authn_file.so
    LoadModule authn_core_module modules/mod_authn_core.so
    LoadModule authz_host_module modules/mod_authz_host.so
    LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
    LoadModule authz_user_module modules/mod_authz_user.so
    LoadModule authz_core_module modules/mod_authz_core.so
    LoadModule auth_basic_module modules/mod_auth_basic.so
    LoadModule auth_digest_module modules/mod_auth_digest.so
    

    【讨论】:

      猜你喜欢
      • 2015-06-11
      • 1970-01-01
      • 2017-01-14
      • 2015-01-10
      • 2017-04-20
      • 2018-05-10
      • 1970-01-01
      • 2014-09-26
      • 1970-01-01
      相关资源
      最近更新 更多