SSL免费证书安装

1、阿里云-申请免费证书

在SSL证书管理-个人测试证书-创建证书,输入域名,选择自动DNS验证

image-20251111165642934

2、审核

image-20251111170412400

3、下载证书文件

image-20251111170525048

4、服务器部署

将下载的证书文件上传到服务器,以nginx网关配置为例

#user  nobody;
worker_processes  1;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
pid /run/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       80;
        server_name  taoxuefeng.com;
        rewrite ^(.*)$ https://$host$1;
        root /home/gitbook/gitbook/_book/;
        index index.html;
    }

    server {
        listen       443 ssl;
        server_name  taoxuefeng.com;
        ssl_certificate     /home/cert/taoxuefeng.com.pem;#SSL证书
        ssl_certificate_key  /home/cert/taoxuefeng.com.key;#SSL证书
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;
        location / {
        root /home/gitbook/gitbook/_book/;
                index index.html;
        }
    }
}

5、重启nginx

查看证书有效期是否生效

image-20251111172113362

results matching ""

    No results matching ""