简体   繁体   English

如何从Python启用内置WSGI服务器的SSL?

[英]How to enable SSL for the built-in WSGI server from Python?

I run a WSGI application from within my Python file, using the make_server command. 我使用make_server命令从Python文件中运行WSGI应用程序。

(I don't know if this is a good practice or whether it is more common to setup Apache or nginx for this purpose.) (我不知道这是一个好习惯,还是为此目的设置Apache或nginx更为普遍。)

I want to make this little server secure by adding SSL support. 我想通过添加SSL支持来确保这台小型服务器的安全。 Where do I start? 我从哪里开始?

Is the built-in WSGI server from Python considered safe? Python内置的WSGI服务器是否安全? I want the connection to be really secure. 我希望连接确实安全。 I only recently came across WSGI and I thought it was very easy to use, especially from within Python. 我只是最近才接触过WSGI,我认为它非常易于使用,尤其是在Python内部。 The app is only used as a proxy so has little functionality, but I do want it to be as secure as possible. 该应用程序仅用作代理服务器,因此功能很少,但我确实希望它尽可能安全。

Basically WSGI is just an interface for communication between a web-server software (ei nginx or httpd ) and your python script/app which contains some code to process requests (usually either application callable or applications list of callables). 基本上, WSGI只是Web服务器软件(ei nginxhttpd )与python脚本/应用程序之间进行通信的接口,其中包含一些处理请求的代码(通常是application可调用或applications application可调用列表)。

You need to enable SSL on the web-server layer. 您需要在Web服务器层上启用SSL。 But if you don't want to involve external software you may follow @Demz's advice and try using eventlet.wrap_ssl . 但是,如果您不想使用外部软件,则可以遵循@Demz的建议并尝试使用eventlet.wrap_ssl Please find more relevant information here . 在此处找到更多相关信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM