Created
February 20, 2019 00:02
-
-
Save allen-munsch/82ec3813607829e99427d19df04bca1d to your computer and use it in GitHub Desktop.
simplest static ssl server in python3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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