首先在云服务器的安全组上添加端口为443的安全组,80端口是http默认端口,443为https默认端口
在/etc/nginx/conf.d/*.conf ·中加入一下代码
server {
listen 80;
server_name nideyuming.com;
root html;
rewrite ^(.*)$ https://$host$1;
location / {
index index.html index.htm;
}
}
server {
listen 443 ssl;
server_name nideyuming.com;
root html;
index index.html index.htm;
ssl_certificate cert/ssl.pem;
ssl_certificate_key cert/ssl.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:80/;
# root html;
# index index.html index.htm; //代理到哪个端口
}
}
免费的ssl证书
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容