nginx将http升级成https

在七牛云(https://www.qiniu.com/)中注册个人或者企业开发人员,然后申请免费版的ssl证书

接着在个人购买的域名服务商中配置TXT域名解析

完成后将下发证书。

接着在nginx 配置文件中加入配置:

listen 443 ssl;
server_name 对应的域名;
index index.html index.htm index.php;
root 虚拟主机配置目录;
ssl_certificate dreamus.net.crt;
ssl_certificate_key dreamus.net.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
完成之后将nginx重启:service nginx restart
这时候就可以看到成果了!

You May Also Like

About the Author: 烟淡黄昏