创buildhtpasswd和编辑htaccess后500错误

我刚刚编辑的htaccess文件包括:

AuthType基本

AuthName“我的保护区”

AuthUserFile / home / path / to / public_html /

要求有效的用户

然后我通过htpasswd命令创build了一个htpasswd文件。 我已经在Apacheconfiguration中启用了模块:LoadModule authn_file_module modules / mod_authn_file.so。

现在,当我加载页面,我现在得到一个500错误和Apache日志说:“configuration错误:无法检查用户。没有用户文件?: /”

AuthUserFile命令由mod_authn_file模块提供。 确保你的Apacheconfiguration包含以下内容:

 LoadModule authn_file_module modules/mod_authn_file.so 

这需要进入主服务器configuration,而不是在.htaccess文件中。 如果您无法访问主服务器configuration,则需要联系您的本地pipe理员。