我是在windows server上用web.py构建的服务器,怎么用阿里云的ssl证书开启https服务?
代码如下:
import web
from model import config
from cheroot.server import HTTPServer
from cheroot.ssl.builtin import BuiltinSSLAdapter
class index:
def GET(self,name):
render=web.template.render("templates/")
if not name:
return render.index("none")
elif name == "home":
cursor = config.dataconfig().table_article()
return render.home(cursor)
elif name == "product":
cursor = config.dataconfig().table_product()
return render.product(cursor)
elif name == "crowfunding":
cursor = config.dataconfig().table_crowfunding()
return render.crowfunding(cursor)
elif name.startswith("article"):
articleIndex = name.split("/")[1]
return render.article(config.dataconfig().article(int(articleIndex)))
ssl_certificate = "D:/main/cert/214530877520094.pem"
ssl_private_key = "D:/main/cert/214530877520094.key"
ssl_chain = "D:/main/cert/chain.pem"
HTTPServer.ssl_adapter = BuiltinSSLAdapter(
certificate=ssl_certificate,
private_key=ssl_private_key,
certificate_chain=ssl_chain)
urls = ('/(.*)','index')
app = web.application(urls,globals())
if __name__== "__main__":
app.run()
-------------------------
-------------------------
-------------------------
-------------------------
-------------------------
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。