We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
0 parents commit 18617b7Copy full SHA for 18617b7
README.md
@@ -0,0 +1,19 @@
1
+# Python3-SimpleHTTPServer-with-SSL
2
+
3
+## Usage
4
+1. Git clone https://github.com/noobpk/Python3-SimpleHTTPServer-with-SSL.git
5
+2. cd Python3-SimpleHTTPServer-withSSL/
6
+3. Generate your certificate :
7
+ 1. `chmod +x generate-cert-selfsign.sh`
8
+ 2. `./generate-cert-selfsign.sh`
9
+4. Add your path of file `cert.pem` to `server.py`
10
+3. Start server: `python3 server.py`
11
12
+## Configure browsers to allow your certificate
13
14
+### Google Chrome
15
+Access : `chrome://flags/#allow-insecure-localhost` and click `Enable`
16
+### Firefox
17
+Access: `about:config` then search `security.enterprise_roots.enabled` and click `True`
18
19
generate-cert-selfsign.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+#generate your certificate self-signed using on local
+openssl req -new -x509 -sha256 -nodes -newkey rsa:2048 -days 365 -keyout cert.pem -out cert.pem
index.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Simple HTTP Server with SSL</title>
+</head>
+<body>
+ <h1>Wellcome to my server!!</h1>
+</body>
+</html>
server.py
@@ -0,0 +1,20 @@
+#!/bin/python3.8
+#server.py
+from http.server import HTTPServer, SimpleHTTPRequestHandler, HTTPStatus
+import socketserver
+import ssl
+IP = '127.0.0.1'
+PORT = 9090
+#Start server without ssl
+# httpd = socketserver.TCPServer((IP, PORT), SimpleHTTPRequestHandler)
+#Start server with ssl
+httpd = HTTPServer((IP, PORT), SimpleHTTPRequestHandler)
+httpd.socket = ssl.wrap_socket (
+ httpd.socket, server_side=True,
+ certfile='/path/to/cert.pem')
+print("Server start at: https://{}:{}".format(IP, PORT))
20
+httpd.serve_forever()
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments