Introduction

Just started creating my own blog, and here I’m documenting the process of using GitHub and Amazon Route 53 to create and deploy a Hexo blog.
Note: Due to different network environments, there might be some issues during the setup. This is just a record of my own process, and I hope it can help you.

Steps

Installing Hexo

The Hexo Official Documentation provides detailed installation instructions, so I won’t repeat them here.

Creating a GitHub Repository

  • Create a new GitHub repository named username.github.io, where username is your GitHub username.
  • Upload the Hexo blog folder to the GitHub repository.
  • In the GitHub repository, go to Settings, find Pages, and set Source to Deploy from a branch. Select the corresponding branch in Branch, usually main or master.
  • Wait a few minutes, and your blog will be accessible at https://username.github.io.

Purchasing a Domain

Purchasing a domain is not necessary, but it does make access more convenient. Here are the steps to purchase a domain through AWS Route 53:

  1. Visit the AWS website and log in to your account.
  2. Select Route 53 from the list of services.
  3. Choose “Registered Domains” to view already registered domains, or select “Register Domain” to register a new domain.
  4. Enter the domain name you want to register in the search bar and click “Search”.
  5. Review the search results, choose the domain you like, and click “Select”.
  6. Click “Continue to Checkout” and complete the purchase.

Configuring the Domain and Project Files

Click on the hosted zone in Route 53 and select the domain you just purchased.

Click “Create Record” and switch to “Quick Create Record”.

  • For “Record Name”, it’s recommended to use “www” or “blog”.
  • For “Record Type”, select “CNAME”.
  • In “Value”, enter your GitHub repository name.

Click “Create Record” to complete the setup.

Create a “CNAME” file in the repository and enter the domain name used in the “Record Name” field.

At this point, the process of creating and deploying a Hexo blog is complete.


Supplement: The CNAME file may disappear during Hexo deployment. This can be resolved by creating a CNAME file in the source folder.

简介

刚刚开始创建自己的博客,这里记录关于使用GitHub和Amazon Route 53创建和部署Hexo博客的过程。

注意事项: 因为每个人搭建时的网络环境不同,所以可能会有一些问题,这里只是记录我自己搭建的过程,希望对你有所帮助。

步骤

安装Hexo

Hexo官方提供了详细的安装教程,这里不再赘述。

创建GitHub仓库

  • 创建一个新的GitHub仓库,仓库名为username.github.io,其中username是你的GitHub用户名。
  • 将Hexo博客的文件夹上传到GitHub仓库。
  • 在GitHub仓库的Settings中找到Pages,将Source设置为Deploy from a branch。在Branch中选择对应的分支,一般是mainmaster
  • 等待几分钟,你的博客就可以通过https://username.github.io访问了。

购买域名

购买域名不是必须的,但它确实让访问变得更加方便。以下是通过AWS的Route 53购买域名的步骤:

  1. 访问 AWS 网站 并登录您的账户。

  2. 在服务列表中选择 Route 53。

  3. 选择“已注册的域”以查看已经注册的域名,或者选择“注册域名”以注册一个新的域名。

  4. 在搜索栏中输入您想要注册的域名,然后点击“搜索”。

  5. 查看搜索结果,选择您喜欢的域名并点击“选择”。

  6. 点击“继续结账”并完成购买

配置域名和项目文件

点击Route53的托管区域,选择刚才购买的域名。

点击“创建记录”,切换到“快速创建记录”。

  • “记录名称”建议直接使用“www”或者“blog”
  • “记录类型”选择“CNAME”
  • “值”内填写Github的仓库名称。

点击“创建记录”则完成设置

在仓库中创建“CANME”文件,在文件内填入“记录名称”中使用的域名

至此,已经完成了Hexo博客的创建到部署的全过程。


补充:Hexo部署时会导致CNAME文件消失的情况,可以通过在source文件夹内创建CNAME文件解决