Nginx服务器安装SSL证书教程

https://help.aliyun.com/document_detail/212905.html

https://help.aliyun.com/document_detail/98728.html

首先在云服务器的安全组上添加端口为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证书

https://freessl.cn/

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容