2012-01-25 77 views
0

我想要得到一个Django应用程序与mod_wsgi Apache上运行。我为/ static和/(Django应用程序)中的任何文件都得到了403(Forbidden)。 apache用户有权访问wsgi.py,并且可以列出/ apps/{DIR}/static。我甚至更改了/ apps/{DIR}中所有文件/目录的用户和组。我可以su到apache用户可以遍历到wsgi.py.我可以手动运行Apache是​​使用httpd -X的调试模式,一切正常! (我可以访问Django应用程序和静态内容),但是当我运行它,通常它不工作,我得到一个403Django与Apache和mod_wsgi得到403(禁止)

RHEL 6.2,Python的 2.6.6, Django的1.3, 的httpd-2.2。 15, mod_wsgi的-3.2

/etc/httpd/conf/httpd.conf中:

WSGIScriptAlias//apps/{DIR}/{APP_NAME}/apache/wsgi.py 
WSGIPythonPath /apps/{DIR}/{APP_NAME} 

<Directory /apps/{DIR}/{APP_NAME}/apache> 
    <Files wsgi.py> 
    Order deny,allow 
    Allow from all 
    </Files> 
</Directory> 

Alias /static /apps/{DIR}/static 
<Directory /apps/{DIR}/static> 
    Order allow,deny 
    Options Indexes 
    Allow from all 
    IndexOptions FancyIndexing 

    #Options FollowSymLinks 
    AllowOverride None 
</Directory> 

在的httpd/error_log中

[...] [error] [client x.x.x.x] (13)Permission denied: access to/denied 
[...] [error] [client x.x.x.x] (13)Permission denied: Can't open directory for index: /apps/{DIR}/static/ 
错误

有没有人有任何想法? 谢谢

+0

你是怎么解决这个问题的?我对CentOS有很大的问题。当启动httpd使用'sudo /etc/init.d/httpd'启动时出现禁止出现,而当我执行'sudo/usr/sbin/httpd'时出现禁止。 – Fedor

回答

0

您是否在启用SELinux的情况下运行?

从'/'的所有目录到Apache用户可读的静态媒体目录,而不仅仅是目录本身?

+0

是的,SELinux正在运行。我修正了SELinux,现在它工作得很好。 谢谢 – user1167710