Advertisement
fduran

apache password protect directory

Nov 3rd, 2011
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.61 KB | None | 0 0
  1. # www.fduran.com
  2. # apache password protect directory
  3.  
  4. # Apache config
  5. <Directory /home/user/public_html>
  6.     AllowOverride AuthConfig
  7.     # ...
  8. </Directory>
  9.            
  10. Alias /protected "/home/user/public_html/protected"
  11. <Location "/protected/">
  12.         SetHandler None
  13.         Options -Indexes +FollowSymLinks
  14.         allow from all
  15. </Location>
  16.  
  17. # auth_* modules needed
  18. a2enmod auth_basic
  19.  
  20.  
  21. # passwd file, outside directory served
  22. htpasswd -c /home/user/.htpasswd myuser
  23.  
  24. # /home/user/public_html/protected/.htaccess file
  25. AuthType Basic
  26. require user myuser
  27. AuthName 'Protected'
  28. AuthUserFile /home/user/.htpasswd
  29.  
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement