Created
July 2, 2013 05:46
-
-
Save umidjons/5907025 to your computer and use it in GitHub Desktop.
Basic Authentication through .htaccess
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create password for user admin in /etc/httpd/mypasswd file | |
htpasswd -c /etc/httpd/mypasswd admin | |
# create .htaccess file in directory that you want restrict access | |
# write these rules | |
AuthType Basic | |
AuthName "Restricted Area" | |
AuthBasicProvider file | |
AuthUserFile /etc/httpd/mypasswd | |
Require valid-user | |
# these modules should be enabled in httpd.conf | |
LoadModule authn_file_module modules/mod_authn_file.so | |
LoadModule authz_user_module modules/mod_authz_user.so | |
LoadModule authz_default_module modules/mod_authz_default.so |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment