Skip to content

Instantly share code, notes, and snippets.

@bastienrobert
Last active October 31, 2017 13:35
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 bastienrobert/811dcb25af1fbc380ace82be540d3697 to your computer and use it in GitHub Desktop.
Save bastienrobert/811dcb25af1fbc380ace82be540d3697 to your computer and use it in GitHub Desktop.
Add password on your Apache server
AuthName "Secured page"
AuthType Basic
AuthUserFile "/var/www/.htpasswd"
Require valid-user
# Use the following command : htpasswd -c /var/www/.htpasswd login
# then, enter your password
login:crypted_password
@bastienrobert
Copy link
Author

If it doesn't work, check your /etc/apache2/apache2.conf, AllowOverride need to be All (not None).

If you don't want to set the password on /var/www but on an other path, don't forget to change the path on .htaccess (AuthUserFile) and when you generate the .htpasswd w/ the command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment