2.16.2009

Apache之userdir

Apache有个userdir的模块
http://httpd.apache.org/docs/2.2/howto/public_html.html

以前没用过,想用一下,可是就是很403,日志也是简单的
Permission denied: access to /~username denied

后来在另一台用yum安装的服务器上找到答案。
# The path to the end user account ‘public_html’ directory must be
# accessible to the webserver userid. This usually means that ~userid
# must have permissions of 711, ~userid/public_html must have permissions
# of 755, and documents contained therein must be world-readable.
# Otherwise, the client will only receive a “403 Forbidden” message.

具体操作过程就是 
#chmod -R 711 /home/*
#cd /home/username/
#chmod 755 -R public_html

一切正常了。

Labels:

8.27.2008

Apache 访问控制

Note: the italic should change to ur own dir and name

In the httpd.conf add the following lines
!!!delete the "
"<"Directory /var/www/the/dir/tocontrol/">"
Options MultiViews
AllowOverride AuthConfig
Order allow,deny
Allow from all
"<"/Dircetory">"


vi /var/www/the/dir/tocontrol/.htaccess
add
AuthType Basic
AuthName "Restricted Files"
AuthUserFile
/var/www/the/dir/tocontrol/.htpaaswd
Require user allow_user

/pathto/htpasswd -c /var/www/the/dir/tocontrol/.htpaaswd allow_user

Labels: ,