<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#3333ff">I just skimmed your email, but make sure selinux isn't causing you problems.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#3333ff">The .htaccess file has to have the right context or the web server won't be able to access it. </div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#3333ff">Check to see what context it has eg: <b>ls -lhZ</b></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#3333ff">If it has a different context than the other files there it is likely the reason for the error.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#3333ff"><br>I'm running fedora, so my normal link I'd send you wouldn't be helpful.</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:#3333ff">I'm not sure where selinux messages are stored on ubuntu servers (/var/log/secure is where it is on fedora). </div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(51,51,255)">These links might be helpful :</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(51,51,255)"><a href="https://linuxhint.com/selinux-on-ubuntu-tutorial/">https://linuxhint.com/selinux-on-ubuntu-tutorial/</a><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small;color:rgb(51,51,255)"><a href="https://www.computernetworkingnotes.com/linux-tutorials/selinux-explained-with-examples-in-easy-language.html">https://www.computernetworkingnotes.com/linux-tutorials/selinux-explained-with-examples-in-easy-language.html</a></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 27, 2022 at 3:31 PM Keith Smith via PLUG-discuss <<a href="mailto:plug-discuss@lists.phxlinux.org">plug-discuss@lists.phxlinux.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
I wanted to password protect a directory. On it's face it is simple. <br>
Not for me today.<br>
<br>
Normal Steps<br>
1) create the .htaccess in the appropriate directory and configure it <br>
properly.<br>
2) create the .htpasswd file using the htpasswd command.<br>
3) set permissions to both files to 644.<br>
<br>
So far so good, however it did not work.<br>
<br>
Been a few years so things have changed.<br>
<br>
I'm on Ubuntu 22.04lts and Apache 2.<br>
<br>
I assumed apache was automatically set to recognize the .htaccess and it <br>
appears to be set that way in the /etc/apache2/apache2.conf.<br>
<br>
Did not work.<br>
<br>
So I edited the /etc/apache2/apache2.conf as I found on the Inter Web <br>
Thingy....<br>
<br>
One website said to edit the /etc/apache2/apache2.conf file and replace <br>
the Directory code with<br>
<br>
<Directory /var/www/your_domain><br>
Options Indexes FollowSymLinks<br>
AllowOverride All<br>
Require all granted<br>
</Directory><br>
<br>
That led to a server 500 error.<br>
<br>
My error.log said it was .htaccess: Unknown Authz provider which took me <br>
into a rabbit hole.<br>
<br>
So then I started many searches that lead me many places.....<br>
<br>
I tried adding<br>
<br>
<Directory /var/www/><br>
Options Indexes FollowSymLinks<br>
AllowOverride None<br>
Require all granted<br>
</Directory><br>
<br>
to the default vhost : /etc/apache2/sites-available/000-default.conf<br>
<br>
Still no success - I thought the default settings were carried forward <br>
to other vhosts configurations? I guess not.<br>
<br>
Finally I added that code to the vhost I was trying to password protect <br>
and whala....<br>
<br>
I an a PHP dev, however I do "mess" with the LAMP stack on occasion.<br>
<br>
Did I miss something along the way? Seems I should have been able to <br>
define<br>
<br>
<Directory /var/www/><br>
Options Indexes FollowSymLinks<br>
AllowOverride None<br>
Require all granted<br>
</Directory><br>
<br>
In the /etc/apache2/apache2.conf or <br>
/etc/apache2/sites-available/000-default.conf. Did I miss something?<br>
<br>
Thanks in advance!!<br>
---------------------------------------------------<br>
PLUG-discuss mailing list - <a href="mailto:PLUG-discuss@lists.phxlinux.org" target="_blank">PLUG-discuss@lists.phxlinux.org</a><br>
To subscribe, unsubscribe, or to change your mail settings:<br>
<a href="https://lists.phxlinux.org/mailman/listinfo/plug-discuss" rel="noreferrer" target="_blank">https://lists.phxlinux.org/mailman/listinfo/plug-discuss</a></blockquote></div>