Skip to content

Instantly share code, notes, and snippets.

@samduy
Created December 31, 2017 12:56
Show Gist options
  • Save samduy/66079fbea4f2df74ecd95940d81e878a to your computer and use it in GitHub Desktop.
Save samduy/66079fbea4f2df74ecd95940d81e878a to your computer and use it in GitHub Desktop.
SSL Encrypted SimpleHTTPServer
# Create SSL cert (follow prompts for customization)
# > openssl req -new -x509 -keyout cert.pem -out cert.pem -days 365 -nodes
# Create httpserver.py
import BaseHTTPServer,SimpleHTTPServer,ssl
cert = "cert.pem"
httpd = BaseHTTPServer.HTTPServer(('192.168.1.10',443),SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket,certfile=cert,server_side=True)
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment