与gunicorn的HTTPS?

与gunicorn的HTTPS?,https,gunicorn,Https,Gunicorn,我在Debian服务器上运行Gunicorn 19.0,为Django 1.8站点提供服务。我还运行nginx为站点的静态资产提供服务 我的DNS由Gandi管理,服务器前面有CloudFlare。该站点在HTTP上运行得很好。现在我想通过HTTPS提供服务。我的问题是如何进行这项工作 我已通过生成证书。现在我的服务器上有一个server.csr和一个myserver.key文件 我有一个运行Gunicorn的脚本,我已将其修改为指向以下证书文件: exec gunicorn ${DJANGO_

我在Debian服务器上运行Gunicorn 19.0,为Django 1.8站点提供服务。我还运行nginx为站点的静态资产提供服务

我的DNS由Gandi管理,服务器前面有CloudFlare。该站点在HTTP上运行得很好。现在我想通过HTTPS提供服务。我的问题是如何进行这项工作

我已通过生成证书。现在我的服务器上有一个
server.csr
和一个
myserver.key
文件

我有一个运行Gunicorn的脚本,我已将其修改为指向以下证书文件:

exec gunicorn ${DJANGO_WSGI_MODULE}:application \
   --certfile=/home/me/server.csr
   --keyfile=/home/me/myserver.key
   --name $NAME \
   --workers $NUM_WORKERS \
   --user=$USER --group=$GROUP \
   --bind=unix:$SOCKFILE \
   --log-level=debug \
   --log-file=-
脚本看起来像往常一样运行得很干净,但是现在如果我转到或那里什么都没有(分别是521和404)

是否需要执行其他步骤

Gunicorn日志显示以下内容:

Starting myapp as hello
[2015-06-25 10:28:18 +0000] [11331] [INFO] Starting gunicorn 19.3.0
[2015-06-25 10:28:18 +0000] [11331] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2015-06-25 10:28:18 +0000] [11331] [ERROR] Retrying in 1 second.
[2015-06-25 10:28:19 +0000] [11331] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2015-06-25 10:28:19 +0000] [11331] [ERROR] Retrying in 1 second.
[2015-06-25 10:28:20 +0000] [11331] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2015-06-25 10:28:20 +0000] [11331] [ERROR] Retrying in 1 second.
[2015-06-25 10:28:21 +0000] [11331] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2015-06-25 10:28:21 +0000] [11331] [ERROR] Retrying in 1 second.
[2015-06-25 10:28:22 +0000] [11331] [ERROR] Connection in use: ('127.0.0.1', 8000)
[2015-06-25 10:28:22 +0000] [11331] [ERROR] Retrying in 1 second.
[2015-06-25 10:28:23 +0000] [11331] [ERROR] Can't connect to ('127.0.0.1', 8000)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US)

我也很困惑,因为大多数gunicorn示例都谈到
.crt
文件,但我只有
.csr
文件

上面@SteveKlein在评论中说了什么:

SSL should be set up in your NGINX config, not your Gunicorn one. 
When you set up NGINX, you'll need to decide if you want to serve 
both plain text and SSL or redirect everything to SSL.

我正在运行NGINX/Unicorn/Rails,所以它可能不是完全类似的,但我认为应该在NGINX配置中设置SSL,而不是在Gunicorn配置中设置SSL。当您设置NGINX时,您需要决定是同时提供纯文本和SSL服务,还是将所有内容重定向到SSL。啊,好的,我明白了。谢谢。CSR是证书签名请求-请在某处提交以获取证书。