本文介绍了Cherrypy 3.2.0:启动引擎以在同一实例中运行HTTP和HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

早上好,

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

I successfully start cherrypy 3.2.0 engine in HTTP OR HTTPS :

# 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以启动http和https?

So, is it possible to configure cherrypy to start both in http AND https in the same cherrypy server ?

感谢ypur回复。

推荐答案

您需要在不同的端口上安装两台服务器:。还有一个似乎没有文档的多服务器配置功能,看看它是否适合你,请参考 _cpconfig中的 _server_namespace_handler()函数。 py

You need to have two servers on different ports: Multiple servers/ports. Also there is a multi-server config feature that seems to be undocumented, see if it works for you, refer to _server_namespace_handler() function in _cpconfig.py.

这篇关于Cherrypy 3.2.0:启动引擎以在同一实例中运行HTTP和HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 19:00