你好,我不得不今天重新安装mod_wsgi(因为我们的红帽服务器再次被扼杀)。 用Django进行部署时有趣的事情发生了。 我一直在获取页面403错误You do not have permission to access /mmc on this server错误。
我的项目文件夹存储在/usr/local/src/djcode/c2duo_mms' The permission of my project folder and all of its contents are set to chmod 755`。 应用程序名称叫做mmc。
django.wsgi file
import os import sys sys.path.append('/usr/local/src/djcode/') sys.path.append('/usr/local/src/djcode/c2duo_mms') os.environ['DJANGO_SETTINGS_MODULE'] = 'c2duo_mms.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandle()
httpd.conf file
WSGIScriptAlias /mmc /usr/local/src/djcode/c2duo_mms/apache/django.wsgi WSGIPythonEggs /tmp <Directory /var/www/html/c2duo_crm/apache> Order allow,deny Allow from all
我看不出有什么问题在这里。 我有我的项目文件夹存储在上次相同的地方,但这次它不工作。
它不仅仅是WSGI脚本文件所在的特定文件夹,它需要Apache用户访问。 所有备份到文件系统根目录的目录也需要Apache用户search。 如果父目录有限制的权限,你会得到这个错误。 有关更多详情,请观看:
http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations
其中涵盖了权限的细节。
更新1
我错过的configuration中的错误是你应该使用:
<Directory /usr/local/src/djcode/c2duo_mms/apache>
并不是:
<Directory /var/www/html/c2duo_crm/apache>
我讨论权限时分心,只是在实际不相关的时候纠正你所说的话。
再看看mod_wsgi中的例子,它显示了WSGIScriptAlias和Directory指令是如何相关的。
确保您的WSGI套接字上的权限是这样的,您的有效用户具有读/写访问权限?
相关文档: http : //code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGISocketPrefix
如果这没有帮助,你的configuration是从备份恢复,还是完全重写? 你能提供更多的configuration吗?