0

Apache 2.4 Version configuration file is enabled with "mod_rewrite" module.

LoadModule rewrite_module modules/mod_rewrite.so

Authentication Modules Loaded and shared the output for the command : apachectl -M | grep 'auth'

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

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

.htaccess file placed under the logfile directory

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.

But it will generate the 500 - Internal server Error and sharing the apache server log

.htaccess: Invalid command 'AuthType', perhaps misspelled or defined by a module not included in the server configuration

1 Answers1

0

The below modules need to be enabled on Apache 2.4 for url authentication

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

Other Support modules - Authenticaiton related

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