Apache mod_wsgi Django 设置 - 禁止 您无权访问此服务器上的 /mysite

发布于 2024-09-24 14:33:03 字数 858 浏览 2 评论 0原文

我已经在 Windows XP 上安装了 python 26、Apache 2.2、modwsgi ap2.2 py26。 apache 加载 modwsgi 很好。 当我检查本地主机时:apache 说 - 它有效! 但是当我尝试打开 Django 目录 mysite: localhost/mysite 我 得到 : 禁止 您无权访问此服务器上的 /mysite。 我已经重新安装并安装了很多次但仍然如此 事物。教程说应该得到:它有效 httpd.conf LoadModule wsgi_module 模块/mod_wsgi.so WSGIScriptAlias / /mysite/apache/mysite.wsgi 运行良好,如: http://docs.djangoproject.com/en /dev/howto/部署/modwsgi/ 我的项目路径是C:\mysite 并根据“http://docs.djangoproject.com/en/dev /howto/部署/modwsgi/" mysite.wsgi 路径为 C:\mysite\apache\mysite.wsgi 我已经搜索了这个问题,但是 Linux 上的解决方案请任何人给我 Windows 上的答案。

错误日志是:- [错误] [客户端 127.0.0.1] 客户端被服务器配置拒绝:C:/mysite/apache/mysite.wsgi 有人可以帮忙解决这个问题吗... 谢谢

I have install python 26, Apache 2.2, modwsgi ap2.2 py26 On windows XP.
and apache loads modwsgi fine.
when I check localhost: apache says - It works!
but when i try to open the Django directory mysite: localhost/mysite i
get :
Forbidden
You don't have permission to access /mysite on this server.
I have re-installed and installed this many times but still the same
thing. The tutorial says should get: It worked
httpd.conf
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias / /mysite/apache/mysite.wsgi
runs fine, as in: http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/
My project path is C:\mysite
and according to "http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/"
mysite.wsgi path is C:\mysite\apache\mysite.wsgi
I have search the for this problem but solution on the Linux please any one give me the answer for windows.

and error log is:-
[error] [client 127.0.0.1] client denied by server configuration: C:/mysite/apache/mysite.wsgi
could someone please help with this...
thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无法言说的痛 2024-10-01 14:33:03

此配置片段来自 Linux,而不是 Windows,但是(除了路径名差异)应该非常代表良好的 mod_wsgi 配置。鉴于您所描述的症状,听起来您没有正确获得 mysite.wsgi 的目录权限块。简而言之,任何想要查看站点任何部分的人都必须能够“访问”包含该文件的目录。

WSGIProcessGroup  foo
WSGIDaemonProcess foo processes=2 threads=5 home=/data/web/foo display-name=foo

DocumentRoot /var/www

WSGIScriptAlias / /data/web/foo/apache/django.wsgi
<Directory /data/web/foo/apache>
  Order allow,deny
  Allow from all
</Directory>

Alias /static/ /data/web/foo/site/foo/static/
<Directory /data/web/foo/site/foo/static/>
  SetHandler None
  Order allow,deny
  Allow from all
</Directory>

This configuration snippet is from Linux, not Windows, but (pathname differences aside) should be pretty representative of a good mod_wsgi configuration. Given the symptoms you've described, it sounds like you didn't get the directory permissions block for mysite.wsgi correct. In short, anyone you want to view any part of your site must have 'access' to the directory that contains that file.

WSGIProcessGroup  foo
WSGIDaemonProcess foo processes=2 threads=5 home=/data/web/foo display-name=foo

DocumentRoot /var/www

WSGIScriptAlias / /data/web/foo/apache/django.wsgi
<Directory /data/web/foo/apache>
  Order allow,deny
  Allow from all
</Directory>

Alias /static/ /data/web/foo/site/foo/static/
<Directory /data/web/foo/site/foo/static/>
  SetHandler None
  Order allow,deny
  Allow from all
</Directory>
风轻花落早 2024-10-01 14:33:03

在httpd.conf中添加以下代码:

<Directory C:/mysite/apache>
  Order deny,allow
  Allow from all
</Directory>

add following code in httpd.conf:

<Directory C:/mysite/apache>
  Order deny,allow
  Allow from all
</Directory>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文