Skip to content

Instantly share code, notes, and snippets.

@xemoe
Last active November 23, 2016 11:54
Show Gist options
  • Save xemoe/179e5e676395b37520e8 to your computer and use it in GitHub Desktop.
Save xemoe/179e5e676395b37520e8 to your computer and use it in GitHub Desktop.
Create htpasswd basic authentication

Install package

sudo apt-get install apache2-utils

Generate htpasswd file

sudo htpasswd -c /var/www/yourweb/.htpasswd yourname

Update .htaccess

AuthType Basic
AuthName "Restricted Content"
AuthUserFile /var/www/yourweb/.htpasswd
Require valid-user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment