Najprościej byłoby użyć proxy przednią serwer końcu jak nginx, haproxy lub apache. Konfiguracja tornada za pomocą ssl jest bardzo powolna, spowalnia tornado, aż do momentu, w którym całkowicie przestaje reagować przy minimalnej liczbie odwiedzin. Szukałem wszędzie, aby uzyskać przyzwoitą prędkość w ruchu ssl używając tornada bezpośrednio, ale nie znalazłem żadnego. Poza tym nie jest źle korzystać z serwera front end.
Ale za pomocą apache f.ex. jako frontowy proxy, zbliżyłem się do natywnych prędkości innych niż ssl.
Ale skonfigurować tornado z SSL, jest prosta:
def main():
handlers = [
(r"/", HomeHandler),
]
settings = dict(
blog_title=u"Tornado Blog",
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
debug=True,
certfile = os.path.join("certs/server.crt"),
keyfile = os.path.join("certs/server.key"),
ssl_options = {
"certfile" : os.path.join("certs/server.crt"),
"keyfile" : os.path.join("certs/server.key"),
},
)
tornado.options.parse_command_line()
http_server = tornado.httpserver.HTTPServer(Application())
http_server.listen(options.port)
tornado.ioloop.IOLoop.instance().start()
main()