Django Apache mod_wsgi权限错误

时间:2016-08-29 12:59:54

标签: python django apache mod-wsgi

在virtualenv中设置了Django但是获得了500内部服务器错误。开发服务器运行良好。

环境:

  • Python 2.7.12
  • Apache 2.4.23
  • Django 1.10
  • Fedora 24

服务器日志:

[Mon Aug 29 12:27:49.364393 2016] [mime_magic:error] [pid 19158] [client 14.2.108.225:49222] AH01512: mod_mime_magic: can't read `/home/fedora/motorable/motorable/wsgi.py'
[Mon Aug 29 12:27:49.364552 2016] [mime_magic:error] [pid 19158] [client 14.2.108.225:49222] AH01512: mod_mime_magic: can't read `/home/fedora/motorable/motorable/wsgi.py'
[Mon Aug 29 12:27:49.364904 2016] [wsgi:error] [pid 19157] (13)Permission denied: [remote 14.2.108.225:1832] mod_wsgi (pid=19157, process='motorable', application='ip-172-31-22-170.ap-southeast-2.compute.internal|'): Call to fopen() failed for '/home/fedora/motorable/motorable/wsgi.py'.

配置:

Alias /static /home/fedora/motorable/static
<Directory /home/fedora/motorable/static>
    Require all granted
</Directory>

<Directory /home/fedora/motorable/motorable>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

WSGIDaemonProcess motorable python-path=/home/fedora/motorable:/home/fedora/mot$
WSGIProcessGroup motorable
WSGIScriptAlias / /home/fedora/motorable/motorable/wsgi.py
WSGISocketPrefix /var/run/wsgi

WSGI正在以守护进程模式运行,我尝试添加WSGISocketPrefix指令,但我不确定还要检查或执行什么操作。第一次在这里试验Django。用户主目录是710,并且应该允许Apache进入,我将apache用户添加到fedora的主要组。

任何人都可以分享一些见解吗?

1 个答案:

答案 0 :(得分:1)

将项目移出主目录到/ var / www / django解决了我的问题。