Flask框架使用SSL协议
1.安装pyOpenSSL库
pip install pyOpenSSL
(仅pip)
2.修改原有代码
端口改为443,在原有参数上加上ssl_context=('证书路径','私钥路径')
即可
app.run(host='0.0.0.0',port=443,ssl_context=('/root/certificate.crt', '/root/private.key'))
1.安装pyOpenSSL库
pip install pyOpenSSL
(仅pip)
2.修改原有代码
端口改为443,在原有参数上加上ssl_context=('证书路径','私钥路径')
即可
app.run(host='0.0.0.0',port=443,ssl_context=('/root/certificate.crt', '/root/private.key'))