Skip to content

Instantly share code, notes, and snippets.

@Rich5
Created April 22, 2016 12:54
Show Gist options
  • Save Rich5/782116e5598d8a0cfa43a69e615369ed to your computer and use it in GitHub Desktop.
Save Rich5/782116e5598d8a0cfa43a69e615369ed to your computer and use it in GitHub Desktop.
Quick SSL Python server
import BaseHTTPServer, SimpleHTTPServer
import ssl
#
# $openssl req -x509 -days 365 -nodes -newkey rsa:2048 -keyout key.pem -out cert.pem
#
httpd = BaseHTTPServer.HTTPServer(('0.0.0.0', 4443), SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket, certfile='cert.pem', keyfile='key.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