Created
February 20, 2012 18:30
-
-
Save fduran/1870533 to your computer and use it in GitHub Desktop.
Apache password protect directory
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
# www.fduran.com | |
# apache password protect directory | |
# Apache config | |
<Directory /home/user/public_html> | |
AllowOverride AuthConfig | |
# ... | |
</Directory> | |
Alias /protected "/home/user/public_html/protected" | |
<Location "/protected/"> | |
SetHandler None | |
Options -Indexes +FollowSymLinks | |
allow from all | |
</Location> | |
# auth_* modules needed | |
a2enmod auth_basic | |
# passwd file, outside directory served | |
htpasswd -c /home/user/.htpasswd myuser | |
# /home/user/public_html/protected/.htaccess file | |
AuthType Basic | |
require user myuser | |
AuthName 'Protected' | |
AuthUserFile /home/user/.htpasswd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment