[英]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.