Reputation: 101
I'm seemingly have problem trying to deploy my Flask app with SSL.
The non-SSL works fine at:
http://transcribe.22ai.net:5000/
But fails to provide a secure connection at
https://transcribe.22ai.net:5000/
Here is my simple code, certificate is from Let's Encrypt:
from flask import Flask, request
import ssl
app = Flask(__name__)
context = ssl.SSLContext()
context.load_cert_chain('fullchain.pem', 'privkey.pem')
'''
Flask Routes
'''
@app.route('/', methods=['GET'])
def index():
return "hello"
if __name__=='__main__':
app.run(ssl_context=context)
Is there something I'm missing?
There is no errors, below is output:
2021-06-13 06:54:15 +0000] [27045] [INFO] Listening at: http://0.0.0.0:5000 (27045)
[2021-06-13 06:54:15 +0000] [27045] [INFO] Using worker: geventwebsocket.gunicorn.workers.GeventWebSocketWorker
[2021-06-13 06:54:15 +0000] [27053] [INFO] Booting worker with pid: 27053
[2021-06-13 06:54:15 +0000] [27054] [INFO] Booting worker with pid: 27054
[2021-06-13 06:54:15 +0000] [27057] [INFO] Starting gunicorn 20.1.0
Thanks in Advance.
Upvotes: 0
Views: 1003
Reputation: 1
Set the port to 443
app.run(ssl_context=('cert.pem', 'key.pem'), port=443)
Upvotes: 0
Reputation: 101
Here's the updated command line run as suggested by Steffen.
gunicorn -b 0.0.0.0:5000 wsgi:app --certfile fullchain.pem --keyfile privkey.pem —-error-logfile ./logs/error.log --capture-output --log-level debug
Upvotes: 1