Securing Apache with htpasswd


htpasswd -c /etc/apache2/.htpasswd username

Add this to /var/www/.htaccess

AuthUserFile /etc/apache2/.htpasswd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic
require valid-user

Then modify this line the /etc/apache2/sites-available/default-ssl virtual host for /var/www/ (since I am only exposing the SSL port to the web):

AllowOverride AuthConfig

Leave a Reply

Your email address will not be published. Required fields are marked *