我对龙卷风SSL配置有疑问。我想处理HTTPS协议。我还阅读了docs和stackoverflow相同的问题。我有SSL证书&关键文件。代码看起来像
settings = dict(
...
ssl_options = {
"certfile": os.path.join("certs/myserver.crt"),
"keyfile": os.path.join("certs/myserver.key"),
},
...
)
def main():
http_server = tornado.httpserver.HTTPServer(tornado.web.Application(handlers,
**settings))
http_server.listen(443)
tornado.ioloop.IOLoop.instance().start()
启动我的应用后。我想从浏览器https://mydomain.com访问,但它无法正常工作,没有任何反应,它会导致请求失败请求错误。我该怎么办? BTW http://mydomain.com:443正在发挥作用。
答案 0 :(得分:8)
您将设置传递给 tornado.web.Application()而不是 tornado.httpserver.HTTPServer
试试这个,
settings = dict(
...
ssl_options = {
"certfile": os.path.join("certs/myserver.crt"),
"keyfile": os.path.join("certs/myserver.key"),
},
...
)
def main():
http_server = tornado.httpserver.HTTPServer(tornado.web.Application(handlers),
ssl_options = {
"certfile": os.path.join("certs/myserver.crt"),
"keyfile": os.path.join("certs/myserver.key"),
})
http_server.listen(443)
tornado.ioloop.IOLoop.instance().start()
更新
settings = dict(
...
ssl_options = {
"certfile": os.path.join("certs/myserver.crt"),
"keyfile": os.path.join("certs/myserver.key"),
},
...
)
def main():
http_server = tornado.httpserver.HTTPServer(tornado.web.Application(handlers), **settings)
http_server.listen(443)
tornado.ioloop.IOLoop.instance().start()