升级所需环境
1.有一台自己的服务器。
2.有自己的域名。
3.ssl认证证书。
4.nginx,并且支持ssl,比较新的版本都会有的!
证书申请
阿里云官网搜索ssl证书。购买步骤如下图。
过个半小时左右就会签发完成。
下载证书
解压之后是一个pem和key的文件。
把它上传到服务器起下
nginx配置
server {
listen 443 ssl;
server_name 你的域名;
ssl_certificate cert/ce.pem;
ssl_certificate_key cert/ce.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root /usr/local/nginx/html;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
#http强制转到https
server {
listen 80;
server_name 你的域名;
rewrite ^(.*)$ https://$host$1 permanent;
}
昨天配置的时候,自己出了点小问题,以为升级会对反向代理有影响,其实没有半毛关系~