[英]How to deploy flask app on AWS EC2 - Internal Server Error?
我想在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和flask。
$ 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上运行。
我不知道该如何处理。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.