本站
1.在github page的设置里打开Enforce HTTPS
2.开启腾讯云cdn里高级设置中的https设置,证书可以免费申请,证书审核通过后添加到cdn上,开启强制跳转https
update:2019-05-02
Vue
1.在vue.config.js中添加
module.exports = {
devServer: {
https: true
},
}
2.因为域名在腾讯云,所以直接去腾讯云申请一个ssl证书,下载证书后里边有nginx用的cet和key,放到nginx中conf/ssl文件夹中
3.修改nginx配置
server {
listen 443 ssl;
ssl_certificate ssl/证书名.crt;
ssl_certificate_key ssl/密钥名.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
server_name 证书对应的域名;
location / {
root c:\dist;
try_files $uri $uri/ @router;
index index.html;
}
location @router {
rewrite ^.*$ /index.html last;
}
}
4.配置好后发现打不开
4.1 申请的证书和部署的二级域名不一致
4.2 腾讯云安全组中的443端口没开放