如何使用nginx安装letsencrypt证书?

时间:2016-03-17 05:09:42

标签: ssl nginx lets-encrypt

我已使用letsencrypt为ubuntu上的最新nginx安装SSL证书。 设置很好,除了:

之外,效果很好

enter image description here

我对SSL知之甚少,不知道发生了什么,但我怀疑: 我暂时为Apache安装了SSL证书,现在转移到Nginx以获得它的http / 2支持。由于nginx插件不稳定,我不得不自己安装证书,这就是我所做的:

在我的nginx配置(/etc/nginx/conf/default.conf)中,我添加了:

server {
    listen       80;
    server_name  [domain];
    return 301   https://$host$request_uri;
}

server {
    listen       443 http2;
    listen       [::]:443 http2;
    server_name  [domain];

    ssl on;
    ssl_certificate /etc/letsencrypt/live/[domain]/cert.pem;
    ssl_certificate_key /etc/letsencrypt/live/[domain]/privkey.pem;
}

这有可能以某种方式打破链条吗?这里的正确方法是什么?

谢谢你们

1 个答案:

答案 0 :(得分:6)

1)对于强烈的Diffie-Hellman并避免Logjam攻击,请参阅this great manual

您需要使用这些指令扩展您的nginx配置(在您生成dhparams.pem文件之后):

ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/ssl/dhparams.pem;

2)对于正确的证书链使用fullchain.pem而不是cert.pem,请参阅this great tutorial了解详情。

你将获得A级:)

3)作为奖励试试这项出色的服务:

"Generate Mozilla Security Recommended Web Server Configuration Files"