Django的+ +的mod_wsgi阿帕奇= 403禁止 [英] Django + mod_wsgi + Apache = 403 Forbidden

查看:146
本文介绍了Django的+ +的mod_wsgi阿帕奇= 403禁止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到在Debian这个错误的所有时间。无论身在何处,我把我的code。

I'm getting this error on Debian all the time. No matter where I put my code.

我已经通过所有其他问题上了这里have't发现什么有用的东西在我的情况。

I've already gone through all other questions on here and have't found anything useful in my case.

下面是默认的站点配置:

Here is the default site config:

WSGIScriptAlias / /home/user/Code/mysite/core/
WSGIPythonPath /home/user/Code/mysite/core/

<VirtualHost *:80>
        ServerAdmin user@site.com
        ServerName http://example.org
        Options -Indexes
        DocumentRoot /var/www/


        <Directory />
#               Options FollowSymLinks
                AllowOverride None
                Allow from all
        </Directory>


<Directory /home/user/Code/site/core/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

<Directory /var/www>
                Options FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
</Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.:
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

是的,我知道这不是把网站首页文件夹一个很好的做法,但它是为以后升级真的很棒。此外,我已经竭尽所能许可明智的。现在我的家目录可以访问和肢解一个完整的局外人,依然无果。我失去耐心在这里,因为我已经失去了一整天时间来部署这个事情。

Yeah, I know it's not a good practice to put the site in home folder, but it is really great for updating later. Also I've tried everything permission-wise. For now my home dir could be access and mutilated by a complete outsider, still to no avail. I'm losing patience here, as I've already lost the whole day trying to deploy this thing.

在Apache日志最后几行:

Several last lines in Apache log:

[ 2014-07-29 12:22:13.5464 7242/b7486700 agents/HelperAgent/Main.cpp:619 ]: PassengerHelperAgent online, listening at unix:/tmp/passenger.1.0.7219/generation-0/request
[ 2014-07-29 12:22:13.5540 7247/b6df2700 agents/LoggingAgent/Main.cpp:318 ]: PassengerLoggingAgent online, listening at unix:/tmp/passenger.1.0.7219/generation-0/logging
[ 2014-07-29 12:22:13.5542 7239/b749e700 agents/Watchdog/Main.cpp:761 ]: All Phusion Passenger agents started!
[Tue Jul 29 12:22:13 2014] [notice] Apache/2.2.22 (Debian) PHP/5.4.4-14+deb7u12 mod_python/3.3.1 Python/2.7.3 mod_wsgi/3.3 Phusion_Passenger/4.0.23 configured -- resuming normal operations
[Tue Jul 29 12:22:18 2014] [error] [client 91.199.251.60] (13)Permission denied: access to / denied
[Tue Jul 29 12:22:20 2014] [error] [client 91.199.251.60] (13)Permission denied: access to / denied
[Tue Jul 29 12:22:21 2014] [error] [client 91.199.251.60] (13)Permission denied: access to / denied
[Tue Jul 29 12:22:21 2014] [error] [client 91.199.251.60] (13)Permission denied: access to / denied
[Tue Jul 29 12:22:22 2014] [error] [client 91.199.251.60] (13)Permission denied: access to / denied
[Tue Jul 29 12:22:22 2014] [error] [client 91.199.251.60] (13)Permission denied: access to / denied
[Tue Jul 29 12:22:24 2014] [error] [client 91.199.251.60] (13)Permission denied: access to / denied
[Tue Jul 29 12:23:06 2014] [error] [client 94.242.206.244] (13)Permission denied: access to /xmlrpc.php denied
~                   

如果需要,我可以给一个更大的图片。

I can give a bigger picture if needed.

推荐答案

有相当多在此配置打破。如果这是一个Django的网站,你甚至在之后设置的mod_wsgi Django文档?

There is quite a lot broken in this configuration. If this is a Django site, are you even following the Django docs on mod_wsgi setup?

有些写错的事情是:


  • 服务器名称应该是一个主机名,而不是一个网址让虚拟主机将被忽略。

  • 的WSGIScriptAlias​​是虚拟主机之外,并且​​由于虚拟主机被忽略,因为在它的Apache设置目标目录的访问权限将被忽略,你会得到一个禁止访问响应。

  • 的WSGIScriptAlias​​是指一个目录,无论如何,有可能时,它应该是指的wsgi.py文件。

  • 设置所有从目录允许/是一个安全的灾难即将发生。

这篇关于Django的+ +的mod_wsgi阿帕奇= 403禁止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆