绑定域名到Hexo博客

前言

放在以前,我会推荐到freenom注册域名,毕竟是免费的嘛。
不过前几天,我原先的域名https://luckyfuy.cf/突然进不去了,查了一下不是DNS解析的问题,到freenom一看状态变成FRAUD了:
Status: FRAUD
不知道是我的网站被误认为诈骗网站了还是freenom玩的把戏,免费的果然就是最贵的,所以我准备换一个域名。

购买

推荐到阿里云的万网去购买域名,首年一般都有优惠。
购买完成后就可以在阿里云的域名控制台看到自己购买的域名:
域名

解析

点击上图中的解析进入云解析DNS,如下图添加记录:
解析

/source/目录下新建一个CNAME文件,写入你的新域名,并更改博客的_config.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://luckyfuy.top
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:
- CNAME

提交之后,等待几分钟就能从新域名跳转到你的博客了。

0%