腾讯云DV SSL证书
官网地址:https://console.qcloud.com/ssl
可以去腾讯搞免费的ssl证书,有效期一年
申请好了需要去域名服务商那里按照腾讯的规则给域名增加一条解析记录!
然后可以下载
解压下载的文件。里面有各种web服务器的证书,选择你用的服务器的版本,我用的是nginx
把证书文件放到你的nginx的conf目录里面
然后修改nginx.conf文件
//这个是让一起习惯http访问的用户自动跳转到https访问
server {
listen 80;
server_name www.sgl520.top;
rewrite ^ https://$http_host$request_uri? permanent; # force redirect http to https
}
server {
listen 443 ssl;
server_name www.sgl520.top;
ssl_certificate 1_www.sgl520.top_bundle.crt;
ssl_certificate_key 2_www.sgl520.top.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
ssl_prefer_server_ciphers on;
#charset koi8-r;
access_log /var/logs/sgl520.log;
location / {
root /home/www/web_two/sglblog;
index index.html index.htm;
proxy_pass http://tomcat_sgl_blog;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
最后平滑的重启下nginx就可以了
注意:服务器的防火墙一定要开发443端口