PythonTip >> 博文 >> Web.py

webpy ssl 加密访问

zihua 2013-09-26 01:09:51 点击: 828 | 收藏


1: 安装openssl

2:

cd /etc/ssl


openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out
server.crt

3:

import web
from web.wsgiserver import CherryPyWSGIServer

CherryPyWSGIServer.ssl_certificate = "/etc/ssl/server.crt"
CherryPyWSGIServer.ssl_private_key = "/etc/ssl/server.key"

urls = ("/.*", "hello")

app = web.application(urls, globals())

class hello:

     def GET(self):
        return 'Hello, world!'

if __name__ == "__main__":
app.run()

原文

原文链接:http://www.simple-is-better.com/news/119

作者:zihua | 分类: Web.py | 标签: ssl | 阅读: 828 | 发布于: 2013-09-26 01时 |