简体   繁体   English

URL 身份验证不适用于使用 Amazon Linux AMI 的 Apcahe2.4 版本

[英]URL Authentication Not Working on Apcahe2.4 version with Amazon Linux AMI

Apache 2.4 Version configuration file is enabled with "mod_rewrite" module. Apache 2.4 版本配置文件通过“mod_rewrite”模块启用。

LoadModule rewrite_module modules/mod_rewrite.so

Authentication Modules Loaded and shared the output for the command : apachectl -M |身份验证模块已加载并共享命令的输出: apa​​chectl -M | grep 'auth' 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)

In apache2.4 - Web Server configuration file for the Application directory在 apache2.4 - Application 目录的 Web Server 配置文件中

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

.htaccess file placed under the logfile directory .htaccess 文件放在 logfile 目录下

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

Accessing the logfile via url , it must ask the url authentication , after the successful validation it will allow to view the file.通过 url 访问日志文件,它必须询问 url 身份验证,成功验证后将允许查看文件。

But it will generate the 500 - Internal server Error and sharing the apache server log但它会生成500 - Internal server Error和共享 apache 服务器日志

.htaccess: Invalid command 'AuthType', perhaps misspelled or defined by a module not included in the server configuration .htaccess:无效的命令“AuthType”,可能拼写错误或由服务器配置中未包含的模块定义

The below modules need to be enabled on Apache 2.4 for url authentication需要在 Apache 2.4 上启用以下模块以进行 url 身份验证

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

Other Support modules - Authenticaiton related其他支持模块 - Authenticaiton 相关

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM