cat <<EOF >/etc/nginx/snippets/ssl-params.conf # from https://cipherli.st/ # and https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH"; ssl_ecdh_curve secp384r1; ssl_session_cache shared:SSL:10m; ssl_session_tickets off; ssl_stapling on; ssl_stapling_verify on; #resolver 8.8.8.8 8.8.4.4 valid=300s; #resolver_timeout 5s; # Disable preloading HSTS for now. You can use the commented out header line that includes # the "preload" directive if you understand the implications. #add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"; add_header Strict-Transport-Security "max-age=63072000; includeSubdomains"; add_header X-Frame-Options DENY; add_header X-Content-Type-Options nosniff;
ssl_dhparam /etc/ssl/certs/dhparam.pem; EOF
# 如果没有做上一步,最后 ssl_dhparam 那句请注释掉
NGINX 的虚拟机配置
1
vim /etc/nginx/sites-enabled/blog.xiaoyuer.cn;
在 server {} 配置块中添加如下内容:
1 2 3 4 5 6 7 8
listen443 ssl http2 default_server; include snippets/ssl-params.conf; ssl_certificate /etc/letsencrypt/live/blog.xiaoyuer.cn/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/blog.xiaoyuer.cn/privkey.pem;
location~ /.well-known { allow all; }
同样的,
1
vim /etc/nginx/sites-enabled/blog.lukeyang.us;
在 server {} 配置块中添加如下内容:
1 2 3 4 5 6 7 8
listen443 ssl http2; include snippets/ssl-params.conf; ssl_certificate /etc/letsencrypt/live/blog.lukeyang.us/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/blog.lukeyang.us/privkey.pem;