【发布时间】: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