I am trying to publish a directory in Linux over HTTPs. I am using the below code.
from http.server import HTTPServer, BaseHTTPRequestHandler,SimpleHTTPRequestHandler
import ssl,os
web_dir = os.path.join(os.path.dirname(__file__), 'as4-web')
cert_path=os.getcwd()
os.chdir(web_dir)
def run(server_class=HTTPServer, handler_class=SimpleHTTPRequestHandler):
server_address = ('',8444)
httpd = server_class(server_address, handler_class)
httpd.socket = ssl.wrap_socket(httpd.socket,
server_side=True,
certfile=os.path.join(cert_path,'cert.pem'),
keyfile=os.path.join(cert_path,'key.pem'),
ssl_version=ssl.PROTOCOL_TLS)
print(f'Starting httpsd server on port 8444')
httpd.serve_forever()
run()
After running the code, a prompt comes up to provide the PEM pass phrase like below.
Enter PEM pass phrase:
After entering the passphrase, I want to run this program in background. Can someone please suggest how to achieve it? I looked for insights over internet but could not make it work unfortunately in my use case.