Question

password protected directory on VPS Ubuntu 14.04``

I just installed LAMP on ubuntu 14.04 and I have problem with password protected directory.

AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile /home/marko/public_html/.htpasswd 
AuthGroupFile /dev/null 
require valid-user

This is my .htaccess file in root of my project.

I enabled and authz_groupfile_module in apache and also apache2-utils is installed.

The problem is when I do drop in my site I can enter my username and password but on every post method I am getting 401 error. For example when I want to log in in my account this is happening, Project is done in php CI fw. Everything is fine when I disable folder protection.

Unauthorized

This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn’t understand how to supply the credentials required.

This is my config file of 000-default.conf

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /home/marko/public_html
        ErrorLog /home/marko/logs/error.log
        CustomLog /home/marko/logs/access.log combined
    <Directory />
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
        Allow from all
    </Directory>
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
What I can do more to get this to work?
Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

I just recreated .htpasswd with this command: htpasswd -c .htpasswd my-username And I still have a problem, anyother solution?

Thanks