Start a Secure Web Server with CloudFlare SSL
Dec-2021
Tools:
- Server with ubuntu (dunno if it works with other OSes)
- Python3 (check if you have it already with python3 ––version)
- CloudFlare account
- Domain name which has SSL activated with CloudFlare NameServers
Download SSL Certificate PEM and KEY
Go to CloudFlare Dashboard > SSL > Origin Server > Create Certificate
Copy PEM and KEY into a file named cert-and-key.pem* one after the other
Create a file web-server.py* anywhere in your ubuntu server and paste that biscuit inside.
from http.server import HTTPServer, SimpleHTTPRequestHandler import ssl httpd = HTTPServer(('0.0.0.0', 443), SimpleHTTPRequestHandler) httpd.socket = ssl.wrap_socket(httpd.socket, certfile='/tmp/cert-and-key.pem', server_side=True) httpd.serve_forever()
Check the path of the pem file that created from cloudflare certificate
Then run it with sudo python3 web-server.py
Have a meditation session.