0

I'm currently searching a solution to re-enable basic authentication with .htpasswd file in Apache 2.4. Everything was ok using Apache 2.2 and then I upgraded to MAMP Pro 6.4 that implements Apache 2.4. The authentication is now just ignored.

I understood that the key thing is the Directory content of the httpd.conf file.

Currently, it is configured like that :

<Directory "/Users/Shared/Shared_Items/hostname.domain.eu">  
        Options Indexes Includes FollowSymLinks  
        AllowOverride All  
        Require all granted  
        AuthType Basic  
AuthName "Munki Repository"  
AuthUserFile /Users/Shared/Shared_Items/hostname.domain.eu/munki_repo/.htpasswd    
Require valid-user
</Directory>  

So I just added the 4 latest lines in the GUI and the app creates the whole thing.

I tried many solutions suggested and found nothing that works.

I really doubt that there's a bug in Apache 2.4 that prevents totally the usage of basic authentication.

Paul
  • 2,755
  • 6
  • 24
  • 35

2 Answers2

1

`This is a complete working Virtalhost, you have to adapt it to your Solution.

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory "/var/www/html">
        AuthType Basic
        AuthName "Restricted Content"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user
    </Directory>
</VirtualHost>
djdomi
  • 1,377
  • 3
  • 10
  • 19
  • Thank you also, I have now a straightforward solution but I keep your solution on my notes ! – Franck Sartori Jul 20 '21 at 20:26
  • if it is solved and I did it not answered, please add on your own the answer and mark it as solution as else the question is open and seeking answers for the next decade – djdomi Jul 21 '21 at 04:07
0

In MAMP, I disabled the option "Require all granted" as suggested by digijay and then in the configuration file, the option is automatically set to "Require host localhost". Then the basic authentication works from a remote client (not on the server locally but this is ok like that).