Apply SSL
- visit SSL for Free and generate SSL certificate for your domain
- You should obtain a sslforfree.zip of files ca_bundle.crt, certificate.crt, private.key
- Generate pem format
- command: openssl rsa -in private.key -text > privateKey.pem
- pem of crt files: Just concatenate certificate.crt and ca_bundle.crt together as the crt.pem
Http Server
- use Python 3 as the example
import http.server
httpd = HTTPServer(('', 80), BaseHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd_socket, certfile='all.pem', keyfile='privateKey.pem, server_side=True)
httpd.serve_forever()
No comments:
Post a Comment