Mininaler HTTPS Webserver
Zur Navigation springen
Zur Suche springen
Python Webserver
- nano https.py
import http.server, ssl
server_address = ('0.0.0.0', 8443)
handler = http.server.SimpleHTTPRequestHandler
httpd = http.server.HTTPServer(server_address, handler)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(certfile="own.crt", keyfile="own.key")
httpd.socket = context.wrap_socket(httpd.socket, server_side=True)
print("HTTPS läuft auf https://0.0.0.0:8443")
httpd.serve_forever()