【发布时间】:2016-08-29 12:59:53
【问题描述】:
已在 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 的主组。
谁能分享一些见解?
【问题讨论】:
-
检查wsgi.py的权限。
-
离题,但是如果
First time experimenting with Django here你应该知道你也可以使用uwsgi,这里是关于如何连接uWSGI+Djangodocs.djangoproject.com/en/1.10/howto/deployment/wsgi/uwsgi和这里如何连接Apache+uWSGIuwsgi-docs.readthedocs.io/en/latest/Apache.html -
wsgi.py 设置为 664,但我确实加入了 Web 服务器组,但仍然一无所获。 @user3479125 我不确定另一个接口模块是否会解决根本问题。
-
不作为文件执行调用,被 apache 拒绝!
exec defitions在哪里? -
你在运行 SELinux 吗?您的主目录权限是否使其他人无法读取/搜索它?
标签: python django apache mod-wsgi