2010-02-10 56 views
2

我正在尝试向运行的Django站点添加基本的Apache名称/密码身份验证。Django站点上的Apache基本身份验证

我遵循example here。我创建了一个htpasswd文件,并在httpd.conf中有以下几点:我在做什么

[[email protected] apache2]$ bin/restart 
Apache isn't running. 
Syntax error on line 25 of /home/annaps/webapps/django/apache2/conf/httpd.conf: 
Invalid command 'AuthUserFile', perhaps misspelled or defined by a module not included in the server configuration 

WSGIScriptAlias//home/ann/webapps/django/domesday.wsgi 
<Directory /home/ann/webapps/apache2> 
AuthType Basic 
AuthName "Authentication Required" 
AuthUserFile "/home/ann/webapps/django/domesday/.htpasswd" 
Require valid-user 
</Directory> 

然而,当我试图启动Apache时,我得到错误信息错误?据我所知,这是所有例子的精确副本。

我不需要指定路径来保护 - 只是整个网站都很好。我不完全确定要在<Directory>标记中放入什么 - 我的Django项目的根,Apache的根(如此处),还是其他?

回答

2

http://readthefuckingmanual.net/error/1385/(我没有挑选的网址故意我发誓!):

确保你在你的httpd.conf有这样的:

LoadModule authn_file_module modules/mod_authn_file.so 
+0

谢谢。这解决了错误信息,但不幸的是我现在有一个500错误。如果我注释掉部分,它就会消失。有任何想法吗? :( – AP257 2010-02-10 17:58:52

+0

您是否检查过服务器的错误日志?他们说什么? – jathanism 2010-02-10 18:38:47

0

AuthUserFilemod_authn_file一部分,这是仅在2.1中提供。确保模块在存在的情况下被加载。如果它不......你将无法使用该指令。