一、阿里云申请免费ssl证书

找到申请页面

登录阿里云控制台 -> 点击左边菜单(云盾控制台概览) -> 点击正文(证书服务) -> 点击右上角证书服务

进入到申请证书页面

品牌:Symantec
证书类型:免费性DV SSL
保护类型:1个域名
域名个数:1个

按官方提示操作

补全信息 -> 提交审核 -> 查看进度 -> 颁发证书 -> 下载证书

二、原先的http链接301跳转到https链接

下载好证书后,需要配置nginx。

server {
        listen       80;
        server_name  hhcycj.com www.hhcycj.com;
        rewrite ^(.*) https://www.hhcycj.com$1 permanent;
}

server {
        listen       443;
        server_name  www.hhcycj.com;
        ssl on;
        ssl_certificate   /cert/215036129428564.pem;
        ssl_certificate_key  /cert/215036129428564.key;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_prefer_server_ciphers on;


        location / {
            root   /www/public;
            index  index.html index.htm index.php;
            try_files $uri $uri/ /index.php?$query_string;
        }


        error_page  404              /404.html;
        error_page   500 502 503 504  /50x.html;

        location = /50x.html {
            root   /www/public;
        }

        location ~* \.php$ {
            root /www/public;
            fastcgi_index   index.php;
            fastcgi_pass    127.0.0.1:9000;
            include         fastcgi_params;
            fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;
            fastcgi_param   SCRIPT_NAME        $fastcgi_script_name;
        }

        error_log    /nginx/logs/www.error.log    error;
}

三、添加站点管理,并认证https

需要把https的站点添加到站点管理
https://ziyuan.baidu.com/site/index

添加完新增的https站点后,需要进行https认证

点击新增的网址 -> 点击左边菜单(HTTPS认证)-> 点击完成认证