Homepage Template Conflict

导言

  1. 在将主页从hugo迁移到mkdocs的过程中,我发现他们的配置文件不同config.toml and mkdocs.yml。所以理论上,可以实现基于同一个md内容的两个主页模板部署的兼容。但是当我迁移完之后,发现hugo的模板完全无法正常显示。这意味着有新添加的文件对hugo的运行产生了影响,但是我并没有察觉。
Read more

Web Server: Nginx V.S. Apache2

常见的web服务器

常见的web服务器有Apache、nginx、IIS

  1. Apache
    1. Apache音译为阿帕奇, 是全世界最受欢迎的web服务器,因其快速、可靠并且可通过简单的API扩充,能将Python\Perl等解释器部署在其上面等优势,受到广泛的关注与使用。
    2. 但是现在用的人少了,而且性能没nginx好
  2. nginx
    1. Apache的致命缺陷就是在同时处理大量的(一万个以上)请求时,显得有些吃力,所以“战斗民族”的人设计的一款轻量级的web服务器——nginx, 在高并发下nginx 能保持比Apache低资源低消耗高性能 ,
  3. IIS
    1. iis是Internet Information Services的缩写,意为互联网信息服务,是由微软公司提供的基于运行Microsoft Windows的互联网基本服务,
Read more

Homepage great template

个人网站的需求分析

功能需求

  1. 博客的标签和分类是必须的
  2. 搜索功能、评论功能(Mkdocs 内置搜索)
  3. icon support and usage

个人需求

  1. 少图片的冷淡风
  2. 但是要有彩色或者加粗等功能来体现文中的重要程度。(Mkdocs 的提示框真好用)

个人主页

  1. 基于Mkdocs
  2. Hexo icarus
  3. Hugo PaperMod
  4. Hexo matery

部署位置

cloudflare pages

  1. 不同于之前的教程, 创建位置有所调整。
    1. Workers & Pagescreate an application, choose the Pages tab and follow the git connection tutorial.
    2. 最大的优点是集成了github和mkdocs,可以直接运行mkdocs build 实现部署

GitHub pages

https://kirrito-k423.github.io/

使用自己的域名

替换shaojiemike.pages.dev 变成自己的域名 shaojiemike.top: cloudflare pages 下直接提供Custom domains 的解析 CNAME www shaojiemike.pages.dev

Git Push 2 Homepage

ibug的网站部署思路

  1. 基于ibug.github.io
  2. 图片markdown两个仓库
  3. 对于acsa的网站
    1. 设置了action产生public/*.html
    2. 通过webhook来实现,服务器接收仓库的event信息。
      1. acsa的nginx接收location转发snode5
      2. snode5的nginx转发到127.0.0.2:9000上
      3. webhook.service接收到信息,然后git clone。并返回信息

hugo网站的action文件

根据公开的仓库,hugo的html文件会产生在gh-pages分支下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: build

on:
push:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
#submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
#extended: true

- name: Build
run: hugo --minify

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/master'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public

webhook的实现

接收端转发到内网的机器上(通过修改vim /etc/nginx/sites-enabled/default

1
2
3
4
5
6
server{
location /_webhook/ {
proxy_pass http://snode5.swangeese.fun;
proxy_set_header Host $http_host;
}
}

记得reload systemctl reload nginx

Nginx中location的作用是根据Url来决定怎么处理用户请求(转发请求给其他服务器处理或者查找本地文件进行处理)。location支持正则表达式,配置十分灵活。我们可以在一个虚拟主机(nginx中的一个server节点)下配置多个location以满足如动静分离,防盗链等需求。

在snode5上nginx也需要转发

1
2
3
location /_webhook/ {
proxy_pass http://127.0.0.2:9000;
}

需要进一步的研究学习

暂无

遇到的问题

暂无

开题缘由、总结、反思、吐槽~~

参考文献