import SimpleHTTPServer import BaseHTTPServer import ssl class MyRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): if self.path == '/': self.path = 'test.html' return SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) Handler = MyRequestHandler server = BaseHTTPServer.HTTPServer(('localhost', 8080), Handler) server.socket = ssl.wrap_socket(server.socket, certfile='server.pem', server_side=True) server.serve_forever()