Loading

Hexo 博客部署至腾讯云

一.安装环境

推荐购买腾讯云活动的轻应用服务器 2C2G 就可以啦,我买的是 45 一年的:点我购买

以下命令默认在 ubuntu 系统上执行

安装 nginx

apt-get install nginx

mkdir /wwwroot/blog

生成博客

hexo deploy

然后把 public 文件夹打包,并上传到服务器上,然后解压博客到 /wwwroot/blog目录下。

└── blog
    ├── 404.html
    ├── about
    │   └── index.html
    ├── archives
    │   ├── 2022
    │   │   ├── 06
    │   │   │   └── index.html
    │   │   ├── 07
    │   │   │   └── index.html
    │   │   └── index.html
    │   └── index.html
    ├── index.html

配置 nginx

vim /etc/nginx/conf.d/blog.conf

server {
            listen 80;
            server_name <配置你的目录>;
            root /wwwroot/blog;
            error_page 404 = /404.html;
            access_log  off;
            
            location / {
                index  index.html;
            }
}

保存后执行 nginx -s reload 命令就可以访问啦。

二.启用 CDN 和 HTTPS

使用腾讯云 CDN https://console.cloud.tencent.com/cdn

免费证书:https://console.cloud.tencent.com/ssl

因为是静态博客,默认会全部缓存,所以发布了新博客,或者对博客有了更改,需要刷新才能看到效果:https://console.cloud.tencent.com/cdn/refresh

image-20220705201018314

posted @ 2022-07-05 21:08  晓晨Master  阅读(433)  评论(0编辑  收藏  举报