【发布时间】:2017-12-23 12:17:03
【问题描述】:
我想在 AWS EC2 上部署烧瓶应用程序。但是我遇到了500 Internal Server Error。
首先,我已经安装了 apache webserver 和 mod_wsgi。
$ sudo apt-get update
$ sudo apt-get install apache2
$ sudo apt-get install libapache2-mod-wsgi
$ sudo apt-get install libapache2-mod-wsgi-py2
我已经安装了 pip3 和烧瓶。
$ sudo apt-get install python3-pip
$ sudo pip3 install flask
这是flaskapp目录下的flask.wsgi文件。
import sys
sys.path.insert(0, '/var/www/html/flaskapp')
from flaskapp import app as application
我已启用 mod_wsgi。
WSGIDaemonProcess flaskapp threads=5
WSGIScriptAlias / /var/www/html/flaskapp/flaskapp.wsgi
<Directory flaskapp>
WSGIProcessGroup flaskapp
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
我终于重启了apache2。
$ sudo apachectl restart
当我转到 AWS EC2 域时,我收到了 500 内部服务器错误。
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
我的 flaskapp 应该在 python3 上运行。
我不知道如何处理这个问题。
【问题讨论】:
-
您是否查看过您的 django 应用程序日志或 Apache 日志,它们可能位于
/var/log/apache或/var/log/httpd中? -
感谢您的回复。
/var/log/apache2/error.log中没有任何内容。并且/var/log目录下没有httpd目录。 -
这可能表明问题来自
wsgi模块并且它正在抑制日志输出,因为Apache 默认为warn级别的日志记录。尝试在您的httpd.conf中设置LogLevel info以在您的日志中显示更多消息。
标签: python apache amazon-web-services amazon-ec2 mod-wsgi