diff --git a/content/posts/fifth.md b/content/posts/fifth.md deleted file mode 100644 index 7c19874..0000000 --- a/content/posts/fifth.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -date: '2025-05-27T21:09:30+08:00' -draft: true -title: 'Fifth' ---- diff --git a/content/posts/forth.md b/content/posts/forth.md deleted file mode 100644 index 51f940e..0000000 --- a/content/posts/forth.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -date: '2025-05-27T21:09:24+08:00' -draft: true -title: 'Forth' ---- diff --git a/content/posts/second.md b/content/posts/second.md deleted file mode 100644 index f645ab5..0000000 --- a/content/posts/second.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -date: '2025-05-27T21:09:13+08:00' -draft: true -title: 'Second' ---- diff --git a/content/posts/the-method-of-replacing-the-SSL-certificate/image-1.png b/content/posts/the-method-of-replacing-the-SSL-certificate/image-1.png new file mode 100644 index 0000000..cfcad70 Binary files /dev/null and b/content/posts/the-method-of-replacing-the-SSL-certificate/image-1.png differ diff --git a/content/posts/the-method-of-replacing-the-SSL-certificate/image.png b/content/posts/the-method-of-replacing-the-SSL-certificate/image.png new file mode 100644 index 0000000..987313a Binary files /dev/null and b/content/posts/the-method-of-replacing-the-SSL-certificate/image.png differ diff --git a/content/posts/the-method-of-replacing-the-SSL-certificate/index.md b/content/posts/the-method-of-replacing-the-SSL-certificate/index.md new file mode 100644 index 0000000..9897378 --- /dev/null +++ b/content/posts/the-method-of-replacing-the-SSL-certificate/index.md @@ -0,0 +1,76 @@ +--- +date: '2025-06-12T20:32:04+08:00' +draft: false +title: '更换SSL证书的方法' +--- + +## 背景说明 + +- 网站通过NGINX代理 +- NGINX通过Docker部署 +- 域名通过阿里云购入 +- SSL证书通过阿里云申请 + +## 更换方法 + +基于上面的背景,更换SSL证书共分为四步: + +1. 申请新的SSL证书 + + ![alt text](image.png) + + 点击```创建证书```,在弹出的页面中,输入```域名名称```,然后点击```提交审核```。等待大概10分钟,就会通过审核并完成证书签发,这个过程无需做任何操作,因为域名和SSL证书都是通过阿里云,所以会自动添加记录值和验证。 + +2. 下载证书 + + ![alt text](image-1.png) + + 服务器类型为Nginx,点击下载。解压之后,可以得到```.key```和```.pem```文件。 + +3. 配置新的SSL证书 + + 把```.key```和```.pem```文件放在```cert/```目录下(替换原来的证书文件)。 + +4. 重启NGINX服务 + + ```bash + docker restart nginx + ``` + +至此,SSL证书更换完成。 + +## 后记 + +如果是首次配置SSL证书,还需要在nginx的配置文件中添加如下内容: + +```nginx +server +{ + listen 443 ssl; + server_name [your domain name]; + + ssl_certificate cert/1970666.xyz.pem; + ssl_certificate_key cert/1970666.xyz.key; + + ssl_session_cache shared:SSL:1m; + ssl_session_timeout 5m; + + location / { + root /usr/share/nginx/html/blog; + index index.html; + try_files $uri $uri/ =404; + } + + access_log /logs/blog.log; +} + +server { + listen 80; + server_name [your domain name]; + + rewrite ^(.*)$ https://$host$1; + location / { + index index.html index.htm; + } +} +``` \ No newline at end of file diff --git a/content/posts/third.md b/content/posts/third.md deleted file mode 100644 index 7e9a517..0000000 --- a/content/posts/third.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -date: '2025-05-27T21:09:19+08:00' -draft: true -title: 'Third' ---- diff --git a/hugo.yaml b/hugo.yaml index 6133fef..6499515 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -1,6 +1,6 @@ -baseURL: http://1970666.xyz/ +baseURL: https://1970666.xyz/ languageCode: zh-cn -title: 魔芋土豆 +title: 技术文章 theme: ["PaperMod"] menu: @@ -25,7 +25,7 @@ params: profileMode: enabled: true title: " " - subtitle: A在川渝的街头巷尾,有一种朴素又迷人的食物,它没有山珍海味的贵气,也没有异国料理的新奇,却总能在寒冷的冬日里,或是疲惫的午后,悄悄地温暖一个人的胃,也安抚一颗心。 + subtitle: 在川渝的街头巷尾,有一种朴素又迷人的食物,它没有山珍海味的贵气,也没有异国料理的新奇,却总能在寒冷的冬日里,或是疲惫的午后,悄悄地温暖一个人的胃,也安抚一颗心。 imageUrl: "/images/website_icon.png" imageTitle: icon imageWidth: 300