http - 樱桃皮3.2.0 : starting engine to run both HTTP and HTTPS in th same instance

标签 http python-3.x https cherrypy

早上好,

我在 HTTP 或 HTTPS 中成功启动了cherrypy 3.2.0引擎:

# ssl variable commes input parameters. Bellow cherrypy configuration is fully configured

if ssl:
    print('Setting up SSL')
    cherrypy.server.ssl_certificate = "conf/private/" + platform.node() + ".crt"
    cherrypy.server.ssl_private_key = "conf/private/" + platform.node() + ".key"


'''
----------------------------------
Start server instance
----------------------------------
'''
if hasattr(cherrypy.engine, 'block'):
    # 3.1 syntax
    cherrypy.engine.start()
    cherrypy.engine.block()
else:
    # 3.0 syntax
    cherrypy.server.quickstart(cherrypy.root, config=py_app_conf)
    cherrypy.engine.start() 

那么,是否可以将cherrypy配置为在同一个cherrypy服务器中以http和https方式启动?

感谢您的回复。

最佳答案

您需要在不同端口上有两台服务器:Multiple servers/ports 。还有一个似乎没有记录的多服务器配置功能,看看它是否适合您,请参阅 _cpconfig.py 中的 _server_namespace_handler() 函数。

关于http - 樱桃皮3.2.0 : starting engine to run both HTTP and HTTPS in th same instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20581342/

相关文章:

python-3.x - 如何在python中读取用户输入直到EOF?

apache - 不要在 OpenShift 设备上强制使用 SSL?

java - 使用 GrailsReader 发送 openConnection 内容中的 formData

ruby - 使用 HTTP 字节范围 header 加速下载

c++ - 使用 libcurl 上传文件

python - 在 pandas 中创建一个分数列,其值取决于另一列的百分位数

python - 关于 Visual Studio Code 上的 Python

javascript - 以编程方式提交执行 JS 的表单

javascript - 如何将 Socket.io 配置为在 https 上的同一端口上运行?

apache - https 的 htaccess 文件错误 500