我正在使用 CentOS
我昨晚换了服务器。
我的 AuthUserFile
文件有问题。
我总是被屏蔽。
我确保:
AuthUserFile /home/rootvideo/.htpasswd
/home/rootvideo/.htpasswd
和 .htaccess
文件具有 0644
权限。 httpd.conf
在所有文件夹中都设置为 AllowOverride All
。 mod_auth
都被加载了。LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_alias_module modules/mod_authn_alias.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
有任何想法吗?
最佳答案
供将来引用:
chmodd 文件到 0660 父目录到 0755 文件的所有者应该是 apache 用户。对于 debian 变体 (ubuntu),这是 www-data。对于 CentOS,它的 apache。
chmod 0660 /mylocation/.htpasswd
chmod 0775 /mylocation
# centOS
chown apache:apache /mylocation/.htpasswd
# ubuntu
chown www-data:www-data /mylocation/.htpasswd
查找您需要的用户:
grep -e '^User' /etc/apache2/apache2.conf
grep -e '^User' /etc/httpd/conf/httpd.conf
关于authentication - AuthUserFile 不起作用,有什么问题?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7883445/