- This note refer on how to setup HTTPS Flask web server with a self - signed certificate.
- The target is Ubuntu 16.04 LTS installed as DigitalOcean droplet.
- Link for tutorials.
- I actually think the point here is to generate a self - signed SSL certs and then refer it in the Flask codes for web server.
- If the point above fails, try these testing points.
- If those testing points are failed then I need to do the "How To Deploy A Flask Application On An Ubuntu VPS" tutorial as well.* This is my StackOverflow discussion for this matter, https://stackoverflow.com/questions/43480718/installing-https-for-my-web-app-in-digitalocean-https-xxx-xxx-xxx-xxx-is-ok. The important parts are those step points I made. At least after following these steps my HTTPS Flask web server is successfully hosted in Ubuntu 16.04 DigitalOcean droplet.
- Screenshot from "How To Create A Self - Signed SSL Certificate For Apache In Ubuntu 16.04" tutorial.
- Screenshot from "How To Deploy A Flask Application On Ubuntu VPS" tutorial.
- Screenshot from basic server setup for Ubuntu 16.04 LTS as a DigitalOcean droplet tutorial.
- Screenshot from StackOverflow about adding SSL certificate in Flask based application.
- This posts is what specifically solve my problem.
- Screenshot from StackOverflow about my progress into getting HTTPS ready Flask application.
- Here is my sample codes to employ SSL certs with SocketIO enabled.
context = ("/etc/ssl/certs/apache-selfsigned.crt", "/etc/ssl/private/apache-selfsigned.key")
if online: sIO.run(app, host="0.0.0.0", ssl_context=context)
else : sIO.run(app)