我想在 AWS EC2 上部署 Flask 应用程序。但是我遇到了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 Internal Server Error。
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上运行。
我不知道如何处理这个问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句