學習鏈接:https://blog.dteam.top/posts/2019-04/%E6%9C%AC%E5%9C%B0https%E5%BF%AB%E9%80%9F%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88mkcert.html

mkcert下載地址:
https://github.com/FiloSottile/mkcert/releases/latest
1、管理員啟動cmd
2、安裝:mkcert-v1.4.3-windows-amd64.exe -install
3、查看本地mkcert保存路徑:mkcert-v1.4.3-windows-amd64.exe -CAROOT
4、生成自簽證書:mkcert-v1.4.3-windows-amd64.exe localhost 127.0.0.1 ::1
5、python3使用生成的證書檔案:下面的代碼
python3版本
import http.server as BaseHTTPServer
import ssl
httpd = BaseHTTPServer.HTTPServer(('0.0.0.0', 8090), BaseHTTPServer.SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket, certfile='./localhost+2.pem', keyfile='./localhost+2-key.pem', server_side=True, ssl_version=ssl.PROTOCOL_TLSv1_2)
print("開啟https服務成功...")
httpd.serve_forever()
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/302750.html
標籤:其他
上一篇:WireShark 使用說明
