以下均采用ciika.com作为例子
---------在linux服务器上操作---------
1:生成key(确保机器上安装了openssl)
openssl genrsa -out ciika.com.key 2048
( SHA-2 和 2048 位加密)
2:生成csr文件(godaddy需要用)
openssl req -new -key ciika.com.key -out ciika.com.csr
---------在godaddy上操作---------
3:上传csr
复制第2步里面生成的csr(ciika.com.csr),粘贴到输入框
4:等待审核结果
5:审核通过后下载证书zip文件
里边包含61925e49dabae55a.crt和gd_bundle-g2-g1.crt
---------在linux服务器上操作---------
6:生成crt文件
cat 61925e49dabae55a.crt gd_bundle-g2-g1.crt > ciika.com.crt
7:更改nginx配置
核心配置为
listen 443;
ssl on;
ssl_certificate ciika.com.crt;
ssl_certificate_key ciika.com.key;
重启后即可访问
测试tls的支持情况
Verify that TLS v1.2 is supported: openssl s_client -tls1_2 -connect ciika.com:443 < /dev/null
Verify that TLS v1.1 is not supported: openssl s_client -tls1_1 -connect ciika.com:443 < /dev/null
Verify that TLS v1.0 is not supported: openssl s_client -tls1 -connect ciika.com:443 < /dev/null
如果nginx重启每次都需要密码,可以重新生成一个key并且使用
openssl rsa -in ciika.key -out ciika.key.unsecure
在nginx里面把实际使用的tls协议打印出来看看
log_format combined_ssl '$remote_addr - $remote_user [$time_local] '
'$ssl_protocol/$ssl_cipher '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
参考:
https://blog.myssl.com/ssl-and-tls-deployment-best-practices/
https://askubuntu.com/questions/319192/how-to-enable-tls-1-2-in-nginx
https://serverfault.com/questions/671983/how-to-disable-tlsv1-0-and-tlsv1-1-in-nginx
http://www.wxapp-union.com/article-1085-1.html
参考链接 :
nginx使用godaddy的ssl证书 :http://ciika.com/page/14/