【记录】阿里云函数计算搭建个人主页

Last updated on March 19, 2024 pm

域名备案后,需要有 DNS 解析到对应的云服务商的国内服务器,并且有活跃的访问,才能避免被撤销备案。而阿里云的服务器太贵了,因此只能在函数计算上挂一个主页来保持备案不掉。用到的主页项目是 KZHomePage

  1. 下载 releases 里的最新版,按注释修改主页
  2. 进入 阿里云数字证书管理服务 申请一个免费的域名证书,避免用根域名
  3. 进入 函数计算FC 创建一个服务
  4. 然后在服务里创建函数,选自定义运行时、处理HTTP请求
  5. 运行环境选 NGINX,进高级配置里将规格调最小
  6. 上传主页,点一次部署代码使其生效
  7. 进函数计算的域名管理里,添加自定义域名,因为要验证 CNAME,所以不能用根域名
  8. 路由绑定到之前创建的函数上,并记得每年手动更新证书
  9. Uptime 里添加一个监控项,保持主页的活跃访问

附加 原链接301跳转

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
location ~ ^/(\d+)\.html$ {
return 301 https://b.limour.top$request_uri;
}
location ~ ^/(?!static)[a-zA-Z0-9-]*-[a-zA-Z0-9-]+(.html)?$ {
return 301 https://hexo.limour.top$request_uri;
}
location / {
gzip on;
gzip_min_length 256;
gzip_comp_level 9;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png application/vnd.ms-fontobject font/ttf font/opentype font/x-woff image/svg+xml;
gzip_vary on;
gzip_buffers 32 4k;
root /data/KZhome;
try_files $uri /index.html;
}

【记录】阿里云函数计算搭建个人主页
https://hexo.limour.top/-ji-lu--a-li-yun-han-shu-ji-suan-da-jian-ge-ren-zhu-ye
Author
Limour
Posted on
August 31, 2023
Updated on
March 19, 2024
Licensed under