开发者

How do I build an WSGI apps built with CherryPyWSGIServer that support both HTTP and HTTPS?

开发者 https://www.devze.com 2022-12-18 14:41 出处:网络
I built a WSGI app and created a standalone wrapper using CherryPyWSGIServer. I see that CherryPyWSGIServer supports HTTPS but I am not sure how to support both HTTP and HTTPS together as it looks lik

I built a WSGI app and created a standalone wrapper using CherryPyWSGIServer. I see that CherryPyWSGIServer supports HTTPS but I am not sure how to support both HTTP and HTTPS together as it looks like the first server.start() blocks. How would I create two servers, one HTTP and one HTTPS, and start them both?

Here is what I have now:

server = CherryPyWSGIServer( (http_ip, http_port),  web_app )
try:
    server.start()
except 开发者_开发百科KeyboardInterrupt:
    server.stop()


Whenever I have done this in the past, I have used Apache or Nginx in front of the webserver, and let those handle the https.


Use a batch file to run your normal HTTP server on port 80 and a separate HTTPS instance on port 443.


Maybe this helps: http://docs.cherrypy.org/stable/refman/process/servers.html#multiple-servers-ports

0

精彩评论

暂无评论...
验证码 换一张
取 消