AllowOverride AuthConfig
AuthType Basic
AuthName "Secrete Aera"
AuthUserFile "/etc/httpd/conf/htpasswd"
Require valid-user
或者
Require user USERNAME
# htpasswd -D htpasswd bob
Deleting password for user bob
# vim htgroup
accessgroup:hiyang hadoop
组名:成员1 成员2 ...
AllowOverride AuthConfig
AuthType Basic
AuthName "Secrete Aera"
AuthUserFile "/etc/httpd/conf/htpasswd"
AuthGroupFile
/etc/httpd/conf/htgroupRequire valid-user
或者
Require user USERNAME
# service httpd reload
Reloading httpd:
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
#UserDir disable
#
# To enable requests to /~user/ to serve the user‘s public_html
# directory, remove the "UserDir disable" line above, and uncomment
# the following line instead:
#
UserDir public_html
</IfModule>
# su - test
$ mkdir public_html #配置中指定的目录名
$ cd public_html
$ vim index.html
Test‘s place.
# chmod o+x test/ #家目录让其他用户可以访问
access_log
"GET /%EF%BD%9Etom/ HTTP/1.1" 404
error_log
File does not exist: /var/www/html/\xef\xbd\x9etom
#<Directory /home/*/public_html>
# AllowOverride none
# Options none
# <Limit GET POST OPTIONS>
# Order allow,deny
# Allow from all
# </Limit>
# <LimitExcept GET POST OPTIONS>
# Order deny,allow
# Deny from all
# </LimitExcept>
#</Directory>
Alias /icons/ "/var/www/icons/"
- Alias 相对于DocumentRoot 绝对路径
原文地址:http://hiyang.blog.51cto.com/10728919/1786352