Skip to content

Instantly share code, notes, and snippets.

@allen-munsch
Created February 20, 2019 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allen-munsch/82ec3813607829e99427d19df04bca1d to your computer and use it in GitHub Desktop.
Save allen-munsch/82ec3813607829e99427d19df04bca1d to your computer and use it in GitHub Desktop.
simplest static ssl server in python3
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
from http.server import HTTPServer, SimpleHTTPRequestHandler
import ssl
httpd = HTTPServer(('localhost', 8443), SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket (httpd.socket,
keyfile="key.pem",
certfile='cert.pem', server_side=True)
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment