Skip to content

Instantly share code, notes, and snippets.

@timkinnane
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timkinnane/6b25d963b00f97a429dd to your computer and use it in GitHub Desktop.
Save timkinnane/6b25d963b00f97a429dd to your computer and use it in GitHub Desktop.
Change .htpasswd setting (specifically on Digital Ocean droplets). Note This is a shell snippet but it can't be executed as is. Step 2 is manual.
# 1. Use htapasswd to set new pass for admin
sudo htpasswd /etc/apache2/.htpasswd admin
# 2. Update /etc/apache2/apache2.conf with folders to be protected
<DirectoryMatch ^.*/protected-folder/>
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</DirectoryMatch>
# 3. Restart Apache
sudo service apache2 reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment