我使用putty将NLP Flask web应用程序部署到ec2实例中,它已成功部署,但当我试图通过运行main.py并在浏览器中使用ec2 URL访问该文件时
ec2-17-203-34-83.ap-south-1.compute.amazonaws.com:8080
我得到以下错误
sign_speak) ubuntu@ip-172-31-10-231:~$ python main.py
* Serving Flask app 'main'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server inst ead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:8080
* Running on http://172.31.10.231:8080
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 134-276-929
182.161.22.6 - - [30/Mar/2023 07:22:39] code 400, message Bad request version ('x02h2x08http/1.1x00#x00x00x00')
182.161.22.6 - - [30/Mar/2023 07:22:39] "ü6Âõ¯új¸kî/©�,÷_ùÁFÄl�è�ñ D3�_î�Ù ¡t©Þãåk�jg��KÜ´HòQg}î�æß�çS� zzÀ+À/À,À0̨̩ÀÀ��/5���3+)ÊÊ �HÓ´£ÁHgÅÈNmÜPU¶äcBoX¶6a2 5*-Dihÿ+
你只需要在你的flask应用中有一个ssl证书。
app.run(debug=True, host='0.0.0.0', ssl_context=('fullchain.pem','privkey.pem'))