Apache AuthBasic模块在Mamp中无法正常工作和识别

时间:2014-12-29 11:17:27

标签: apache .htaccess mamp .htpasswd

在我的本地系统上,我试图获取密码来保护在Mamp 3.0.7.2上运行.htaccess的目录。 Mamp使用的Apache版本是Apache / 2.2.29(Unix)。 httpd.conf文件

/applications/mamp/conf/apache/httpd.conf

包含以下有效行:

LoadModule authn_file_module modules/mod_authn_file.so

我的测试项目

/applications/mamp/htdocs/sandbox/testproject/admin/.htaccess

包含以下几行:

AuthBasic Basic
AuthName "Admin Area"
AuthUserFile /applications/mamp/htdocs/sandbox/.htpasswd
require valid-user

在沙盒文件夹下面创建了.htpasswd文件,仅用于测试目的:

htpasswd -c .htpasswd adminuser

在沙盒文件夹中使用pwd .htpasswd我已经提取了确切的路径以防止导致

的任何拼写错误
/applications/mamp/htdocs/sandbox/.htpasswd

但是当我尝试访问admin文件夹中的index.php文件时,我在浏览器中获得以下内容:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, you@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

并且php_error.log在每次尝试时输出以下内容:

[Mon Dec 29 11:23:30 2014] [alert] [client ::1] /Applications/MAMP/htdocs/sandbox/testproject/admin/.htaccess: Invalid command 'AuthBasic', perhaps misspelled or defined by a module not included in the server configuration

但AuthBasic命令如何拼写错误或不包括在内,因为它实际上已正确定义,如上所示。 :/

0 个答案:

没有答案