使用 Django 在 Apache 中拒绝访问
我正在尝试设置一个像 AlwaysData 上解释的 Django 项目,但在我自己的计算机上。
我正在使用 ArchLinux。
当我转到包含 FastCGI 脚本的目录(与上面的链接中相同的 django.fcgi)时,我的 error_log 中的访问被拒绝:
client denied by server configuration: /var/www/home
但是,如果我转到 directory/django.fcgi,我可以访问该项目
而不仅仅是 directory/
。
我的 .htaccess 是:
AddHandler fastcgi-script .fcgi
Options +ExecCGI
DirectoryIndex django.fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]
如果我注释最后一行,我不会收到拒绝访问错误,并且我可以通过两种方法访问我的 django 项目(directory/
和 directory/django.fcgi< /代码>)。
尽管如此,我需要这个 .htaccess 的最后一行来获取干净的 URL。
你知道我的配置有什么问题吗?
I am trying to setup a Django project like explained on AlwaysData, but on my own computer.
I'm using ArchLinux.
I got an access denied in my error_log when I went to the directory containing the FastCGI script (the same django.fcgi as in the link above) :
client denied by server configuration: /var/www/home
However, I can access the project if I go to directory/django.fcgi
instead of only directory/
.
My .htaccess is :
AddHandler fastcgi-script .fcgi
Options +ExecCGI
DirectoryIndex django.fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]
If I comment the last line, I does not get the acces denied error and I can access my django project by both methods (directory/
and directory/django.fcgi
).
Nevertheless, I need the last line of this .htaccess to get clean URLs.
Do you know what is the problem in my configuration?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终使用 mod_wsgi 解决了我的问题。
I finally used mod_wsgi to solve my problem.