1. 安装sshd服务
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 安装
sudo dnf install -y openssh-server

# 启动
sudo systemctl enable sshd

# 状态
sudo systemctl status sshd

# 重启
sudo systemctl restart sshd

# 防火墙允许
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload
2. 配置文件

修改配置文件相应的值,才能够进行ssh远程连接。vim /etc/ssh/sshd_config

1
2
3
4
PasswordAuthentication yes      # 开启密码登录
PermitRootLogin yes # 开启root登录
PubkeyAuthentication yes # 开启公钥登录
UsePAM yes # 启用PAM身份验证模块

修改后重启sshd服务,sudo systemctl restart sshd

地址。按官网所说安装
Caddy为golang程序,不会有各种依赖,单独的一个文件就是执行程序,cp到 /usr/local/bin就安装完成了。

输入whereis caddy可以看到 /usr/bin/caddy/etc/caddy/Caddyfile/usr/share/caddy,其中etc/caddy/Caddyfile是配置文件。编辑配置文件 vim Caddyfile

1
2
3
4
{
admin off
}
import /etc/caddy/sites/*.conf

再在 /etc/caddy 下新建 sites 文件夹,此后,将配置文件写里面即可。
配置文件 vim example.com.conf

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# 不指定服务端口,或者指定了服务端口但不是80端口,则默认使用SSL,且端口为443
example.com {
root * /var/www
file_server
}


# http方式1
example.com:80 {
root * /var/www
file_server
}
# http方式2
http://example.com:xxxx {
root * /var/www
file_server
}


# 使用自定义SSL证书
example.com {
root * /var/www
tls 公钥路径 私钥路径
file_server
}


# 映射多个域名
example1.com, example2.com {
root * /var/www
file_server
}


# 反向代理
example.com {
# 1. 访问https://example.com,实际上是访问localhost:8888
reverse_proxy localhost:8888
# 2. 访问https://example.com/example,实际上是访问localhost:8888
reverse_proxy /example localhost:8888
# 3. 访问https://example.com/example,实际上是访问localhost:8888/example
reverse_proxy / localhost:8888/example/
# 4. websocket反向代理。客户端请求的wss://ws.example.com/ws,实际为wss://127.0.0.1:8888/ws
reverse_proxy /ws 127.0.0.1:8888
}


# 域名重定向1:访问example1.com会301(永久重定向),并重定向到example2.com
example1.com {
redir https://example2.com{url}
}
# 域名重定向2:访问example1.com会302(临时重定向),并重定向到example2.com
example1.com {
redir https://example2.com{url} permanent
}


# 负载均衡
example.com {
reverse_proxy localhost:x localhost:y {
lb_policy first
}
}


# 跨域访问

一个比较全面的caddy配置文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
example.com {
# gzip压缩,提高访问速度
gzip
# 允许浏览站点目录,不填默认禁止
browse
# 日志存放地址
log /etc/caddy/log/access.log
# 反向代理
revers_proxy localhost:xxxx {

}
errors {
log /etc/caddy/log/error.log {
# 大于50m,则自动分割
size 50
# 最多保留30天
age 30
# 最多保存5个文件
keep 5
}
}
}

修改配置后,systemctl reload caddy重加载配置。

1. 创建Linux容器

安装Container Station后,部署一个linux发行版(使用focal版本),部署时网络要选择Bridge如下:
Ubuntu-
Ubuntu-

2. 设置静态IP地址

运行后,在操作处执行终端,进入shell,如下:
Ubuntu-02
Ubuntu-03
进入终端后,可输入passwd root重设root密码。
打开/etc/netplan下的配置文件,名字或有所不同。vi /etc/netplan/10-lxc.yaml

1
2
3
4
5
6
7
8
9
network:
version: 2
ethernets:
eth0:
dhcp4: false
addresses: [192.168.31.78/23] # IP地址和掩码
gateway4: 192.168.31.1 # 网关
nameservers:
addresses: [114.114.114.114, 8.8.8.8] # DNS地址

保存后,输入netplan apply应用设置。

3. 安装v2rayA

文档地址

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
sudo -i

apt update

apt install iptables

apt install curl

apt install wget

wget -qO - https://apt.v2raya.org/key/public-key.asc | sudo tee /etc/apt/trusted.gpg.d/v2raya.asc

echo "deb https://apt.v2raya.org/ v2raya main" | sudo tee /etc/apt/sources.list.d/v2raya.list

apt update

sudo apt install v2raya v2ray

systemctl start v2raya.service

systemctl enable v2raya.service

完成上述操作后,更改v2rayA启动参数,禁用IPv6。编辑v2raya.service,# vi /usr/lib/systemd/system/v2raya.service。在ExecStart处添加启动参数--ipv6-support off
原:
ExecStart原
修改后:
ExecStart修改后
之后重载systemctl并且重启.systemctl daemon-reloadreboot
然后打开http://192.168.31.78:2017/,即可进行设置。
v2rayA设置

目前是vue3
按照文档在预定目录下进行项目创建即可。npm create vue@latest。如果提示网路错误,则需要设置npm镜像源或者设置npm代理。

ssh命令进行远程连接

想要链接的远程linux主机需要安装ssh服务(SSH 为建立在应用层基础上的安全协议。SSH 是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议)。

1
2
3
ssh 用户名@ip地址

// 例子:ssh root@192.168.1.1

之后输入登陆密码就可以了。

SSH登陆失败

1. Host key verification failed

1
2
3
4
5
6
7
8
9
10
11
12
13
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:9Vh/HwSVrme7tqZgQZ82G0SyYPhzMMqT7iaczHw3Nq8.
Please contact your system administrator.
Add correct host key in C:\\Users\\Umino/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\Umino/.ssh/known_hosts:2
ECDSA host key for 47.105.81.6 has changed and you have requested strict checking.
Host key verification failed.

系统每次成功进行SSH连接远程操作,都会把访问过的计算机的public key记录在 .ssh文件夹 的 known_hosts 中。下次再远程访问服务器的时候,会核对公钥,如果公钥不同,会发出警告,并且不能连接上去,避免受到攻击。

  • 解决方法1:在 known_hosts 中,找到对应的服务器ip的 ssh-rsa 删除该行,退出保存known_hosts,重新执行主机ssh连接子机,通过操作。
  • 解决方法2:重新获取公钥
    1
    ssh-keygen -R 要访问的ip
  • 解决方法3:建立主机和子机的相互信任机制
    1. A机 .ssh/ 目录下
      1
      ssh-keygen -t rsa
      1
      cd /root/.shh/id_rsa.pub
      把A公钥id_rsa.pub生成key copy到B服务器根目录root/.ssh/下

地址

1. 服务端

  1. 配置 vim /usr/lib/systemd/system/frps.service,实现设置systemctl 管理。类似可配置frpc.service。
    frps.service(vim /usr/lib/systemd/system/frps.service):
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    [Unit]
    Description=Frps Server Service
    After=network.target

    [Service]
    Type=simple
    User=nobody
    Restart=on-failure
    RestartSec=5s
    ExecStart=/home/frp/frps -c /home/frp/frps.toml

    [Install]
    WantedBy=multi-user.target
    frpc.service(vim /usr/lib/systemd/system/frpc.service):
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    [Unit]
    Description=Frpc Server Service
    After=network.target

    [Service]
    Type=simple
    User=nobody
    Restart=on-failure
    RestartSec=5s
    ExecStart=/home/frp/frpc -c /home/frp/frpc.toml

    [Install]
    WantedBy=multi-user.target
  2. 下载相应版本的frp(下载到home文件夹内)
    1
    wget https://github.com/fatedier/frp/releases/download/v0.54.0/frp_0.54.0_linux_amd64.tar.gz
  3. 解压&复制&给予权限
    1
    2
    3
    4
    5
    tar -xzvf frp_0.54.0_linux_amd64.tar.gz
    cp -r frp_0.54.0_linux_amd64 frp

    # 给予权限
    chmod -R 777 frp
  4. 进入frp文件夹,编辑frps.toml,vim frps.toml
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    # frp服务器端口,防火墙需要开放
    bindPort = 14000
    # 自定义监听端口,所有对该端口的访问将被转发到本地内网,配合反向代理可不做防火墙放行
    vhostHTTPPort = 14001
    vhostHTTPSPort = 14002
    # QUIC 绑定的是 UDP 端口,可以和 bindPort 一样
    quicBindPort = 14003
    # 认证token,frpc/frps通信认证
    auth.token = "psw"
    # 是否启用端口复用
    transport.tls.disableCustomTLSFirstByte = false

    # 日志输出文件路径
    log.to = "slog"
    # 日志文件最多保留天数
    log.maxDays = 7

    # 服务端监听面板
    webServer.addr = "0.0.0.0"
    webServer.port = 14004
    webServer.user = "admin"
    webServer.password = "psw"
    #webServer.tls.certFile = "Your server.crt"
    #webServer.tls.keyFile = "Your server.key"
  5. 启动&添加到开机自启动
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    # 启动
    sudo systemctl start frps
    sudo systemctl start frpc
    # 重启
    sudo systemctl restart frps
    sudo systemctl restart frpc
    # 添加到开机自启动
    systemctl enable frps
    systemctl enable frpc
    # 查看状态
    systemctl status frps
    systemctl status frpc

    2. 配置NGINX

    实现反向代理,vim /etc/nginx/conf.d/frp.domain.com.conf
    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
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    # 服务端监听面板
    server {
    listen 443 ssl;
    server_name frpi.domain.com; # 域名
    ssl_certificate /home/certs/domain.com.pem; # ssl路径
    ssl_certificate_key /home/certs/domain.com.key; # ssl路径
    # 其他ssl设置
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_timeout 10m;
    ssl_session_cache builtin:1000 shared:SSL:10m;
    ssl_buffer_size 1400;
    add_header Strict-Transport-Security max-age=15768000;
    ssl_stapling on;
    ssl_stapling_verify on;
    # access_log /etc/nginx/conf.d/logs/example.com.log combined;

    location / {
    proxy_pass http://localhost:14004; # 代理的服务端口
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    }
    }
    server {
    listen 80;
    server_name frpi.domain.com; # HTTP重定向到HTTPS
    return 301 https://$server_name$request_uri;
    }

    # frp服务端口代理
    server {
    listen 80;
    listen [::]:80;
    server_name frps.domain.com;

    location / {
    proxy_pass http://localhost:14000; # 将流量发送到应用程序所在的端口
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    }
    }

    # 穿透的服务端口
    server {
    listen 80;
    server_name *.frp.domain.com;

    location / {
    proxy_pass http://localhost:14001; # 将流量发送到应用程序所在的端口
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    }
    }
    重启nginx,sudo systemctl restart nginx。至此,服务端配置完毕。

3. 客户端

编写frpc.toml

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# 远程服务器地址,支持域名和ip
serverAddr = "xxx.xxx.xxx.xx"
# 远程服务器监听端口,可以配合nginx反向代理实现去端口
serverPort = 14000
# 启用quic协议
#transport.protocol = "quic"
#quicBindPort = 14003
# 认证token,frpc/frps通信认证
auth.token = "password"
# 启用端口复用
transport.tls.disableCustomTLSFirstByte = false

# 客户端面板
webServer.addr = "127.0.0.1"
webServer.port = 14004
webServer.user = "user"
webServer.password = "password"

# 日志输出文件路径
log.to = "clog"
# 日志文件最多保留天数
log.maxDays = 7

# 以上为frpc固定项配置

[[proxies]]
name = "web"
type = "http"
localIP = "127.0.0.1"
localPort = 8888
customDomains = ["xx.frp.domains.com"]

# 需要增加本地服务的话,增加 proxies 配置和子域名即可

# 相对完整的代理示例,一般情况下http代理只需要填写到 customDomains 即可
# [[proxies]]
# name = "web"
# type = "http"
# localPort = 80
# customDomains = ["www.yourdomain.com"]

# # 代理负载均衡,相同groupKey的代理,会视为负载均衡
# # 对于 tcp 类型代理,需要确保 groupKey 相同以进行权限验证,同时 remotePort 也需一致。
# # 对于 http 类型代理,需要保证 groupKey, customDomains(自定义域名),subdomain 和 locations 相同。
# loadBalancer.group = "web"
# loadBalancer.groupKey = "123"

# # 启用健康检查,类型为 http
# healthCheck.type = "http"
# # 健康检查发送 http 请求的 path,后端服务需要返回 2xx 的 http 状态码
# healthCheck.path = "/status"
# # 建立连接超时时间为 3 秒
# healthCheck.timeoutSeconds = 3
# # 连续 3 次检查失败,此 proxy 会被摘除
# healthCheck.maxFailed = 3
# # 每隔 10 秒进行一次健康检查
# healthCheck.intervalSeconds = 10

# # 获取用户真实IP,具体配置见 https://gofrp.org/zh-cn/docs/features/common/realip/
# transport.proxyProtocolVersion = "v2"
# # 带宽限速,支持MB,KB
# transport.bandwidthLimit = "1MB"

启动:./frpc -c ./frpc.toml

服务器端设置好反向代理、域名供应商处设置好子域名后,即可用xx.frp.roaring.win:8080访问本地服务。

4. 加密的SSH链接

按前设置好frp服务器端。然后分别在两台计算机上(A、B,假设要从B访问A)设置好frp客户端,即可进行SSH连接。

  1. 计算机A(目标计算机)

    1
    2
    3
    4
    5
    6
    7
    # frpc.toml
    [[proxies]]
    name = "xx_secret_ssh"
    type = "stcp"
    secretKey = "psw"
    localIP = "127.0.0.1"
    localPort = 22

    在计算机A上启动frpc服务,./frpc -c ./frpc.toml

  2. 计算机B

    1
    2
    3
    4
    5
    6
    7
    [[visitors]]
    name = "xx_ssh_visitor"
    type = "stcp"
    serverName = "xx_secret_ssh"
    secretKey = "psw"
    bindAddr = "127.0.0.1"
    bindPort = 6000

    在计算机B启动frpc服务,./frpc -c ./frpc.toml

设置完毕,在计算机B上可通过ssh -oPort=6000 root@127.0.0.1连接计算机A。

1. deployer发布

  1. 将项目上传到git
  2. 项目内安装hexo deployernpm install hexo-deployer-git --save
  3. 编辑_config.yml,新增deploy,并且更改url地址
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # URL
    ## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
    url: https://umino-natsusou.github.io/<项目名>

    deploy:
    type: git
    repo: https://github.com/<username>/<project>
    # example, https://github.com/hexojs/hexojs.github.io
    branch: gh-pages
  4. 输入 hexo d 发布

2. 公共仓库和私有仓库协同发布

  1. hexo源码上传到私有仓库,令建一个公共仓库用来发布page
  2. 用github工作流来简化发布流程:.github/workflows目录下新建自定义yml后缀的文件,写上如下
    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
    31
    32
    33
    34
    35
    36
    name: Deploy Site
    on:
    push:
    branches: [ main ]

    jobs:
    build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
    uses: actions/checkout@v3
    with:
    persist-credentials: true # false 是用 personal token,true 是使用 GitHub token
    fetch-depth: 0

    # ... TODO Build your site

    # <work-dir> 静态资源所在的目录
    # <domain> 需要 github.io 绑定的域名
    # <username> git commit 用户名
    # <mail> git commit 邮箱
    # <message> git commit 的 message
    # <secrets_name> Secrets 名称
    # <github_username> github 的用户名(公开仓库)
    # <repo> 公开仓库名
    # 添加域名的在run下添加一行: echo "<domain>" > CNAME
    # secrets是github的全域变量,test是在源码仓库Settings的Secrets里定义的,填上Settings -> Developer settings里的token
    - name: Commit and Push
    working-directory: public
    run: |
    git init
    git checkout -b gh-pages
    git add -A
    git -c user.name='umino-natsusou' -c user.email='uminonatsusou@gmail.com' commit -m 'deploy site'
    git remote add origin https://${{secrets.test}}@github.com/umino-natsusou/AncientreesDeploy.git
    git push origin gh-pages -f -q

一. 创建分类

  1. 命令行执行,成功后source下生成categories目录。
1
hexo new page categories
  1. 打开source/categories/index.md,添加type: "categories" layout: "categories"
    到其中。
1
2
3
4
5
6
---
title: 文章分类
date: 2022-01-07 22:53:43
type: "categories"
layout: "categories"
---
  1. 给文章添加“categories”属性:
1
2
3
4
5
6
7
---
title: 文章1
date: 2022-11-07 22:53:43
categories:
- 人工智能
- Python
---

如上,文章1属于分类“人工智能 -子分类 Python”,一篇文章只能属于一个分类,可以往后添加多个子分类。

二. 创建标签

  1. 命令行执行,成功后source下生成categories目录。
1
hexo new page tags
  1. 打开source/tags/index.md,添加type: "categories" layout: "categories"
    到其中。
1
2
3
4
5
6
---
title: 文章分类
date: 2022-01-07 22:53:43
type: "tags"
layout: "tags"
---
  1. 给文章添加“tags”属性:
1
2
3
4
5
6
7
8
9
10
11
---
title: 文章1
date: 2022-11-07 22:53:43
categories:
- 人工智能
- Python
tags:
- jQuery
- 表格
- 表单验证
---

三. 添加到模板

在模板文件(scaffolds中)中添加分类和标签属性,以后新建的日志就会自动添加这两个属性了。

1
2
3
4
5
6
---
title: {{ title }}
date: {{ date }}
categories:
tags:
---

四. 在指定目录下新建文章

在/_post目录(对应模板目录)下新建目录,新建文章时执行 type:hexo new <layout> -p <directory>/<name>

文档地址

  1. 安装Hexo:npm install -g hexo-cli
  2. 新建文件夹项目Ancientree ,在文件夹内执行: hexo init
  3. 然后:npm install
  4. 启动:hexo g 编译,然后hexo s启动

一. 新建与删除

  1. 新建:hexo new [layout] <title>
  2. 在指定目录下新建:在/_post目录(对应模板目录)下新建目录,然后执行 hexo new <layout> -p <directory>/<name>,如hexo new post -p test/test 。或者对应文件夹内直接新建
  3. 删除:直接删除对应文件就可以,然后重新编译:
    1
    2
    3
    4
    5
    6
    7
    hexo clean

    hexo g

    hexo s

    hexo d

二. 更换主题Next

项目地址文档地址npm install hexo-theme-next@latest —save

  1. 根目录中新建文件_config.next.yml,在这里配置Next。
  2. 自定义样式:suorce文件夹下新建_data文件夹,在文件夹中新建各种样式文件,然后修改配置文件,添加样式文件的路径即可。
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    # 自定义样式文件路径
    custom_file_path:
    #head: source/_data/head.njk
    #header: source/_data/header.njk
    #sidebar: source/_data/sidebar.njk
    #postMeta: source/_data/post-meta.njk
    #postBodyEnd: source/_data/post-body-end.njk
    footer: source/_data/footer.njk
    #bodyEnd: source/_data/body-end.njk
    #variable: source/_data/variables.styl
    #mixin: source/_data/mixins.styl
    style: source/_data/styles.styl
  3. 删除网页底部信息栏:_data文件夹中新建styles.styl,添加以下样式
    1
    2
    3
    .powered-by {
    display: none
    }
  4. 增加文章阴影:styles.styl中添加以下添加样式
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    if (hexo-config('motion.transition.post_block')) {
    .post-block {
    visibility: hidden;
    margin-top: 60px;
    margin-bottom: 60px;
    padding: 25px;
    border-radius: 20px 20px 20px 20px;
    -webkit-box-shadow: 0 0 5px rgba(202, 203, 203, .5);
    -moz-box-shadow: 0 0 5px rgba(202, 203, 204, .5);
    }
    .pagination, .comments {
    visibility: hidden;
    }
    }
  5. 开启本地搜索功能。
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    // 安装插件
    npm install hexo-generator-searchdb --save

    // 修改 hexo/_config.yml 站点配置文件,新增以下内容
    search:
    path: search.xml
    field: post
    format: html
    limit: 10000

    // 修改主题配置文件,启用搜索
    local_search:
    enable: true
  6. 网站运行时间设置:_data文件夹下新footer.njk文件。添加以下:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    <!-- 网站运行时间的设置 -->
    <span id="timeDate">载入天数...</span>
    <!-- <span id="times">载入时分秒...</span> -->
    <script>
    var now = new Date();
    function createtime() {
    var grt= new Date("11/17/2022 8:00:00");//此处修改你的建站时间或者网站上线时间
    now.setTime(now.getTime()+250);
    days = (now - grt ) / 1000 / 60 / 60 / 24; dnum = Math.floor(days);
    hours = (now - grt ) / 1000 / 60 / 60 - (24 * dnum); hnum = Math.floor(hours);
    if(String(hnum).length ==1 ){hnum = "0" + hnum;} minutes = (now - grt ) / 1000 /60 - (24 * 60 * dnum) - (60 * hnum);
    mnum = Math.floor(minutes); if(String(mnum).length ==1 ){mnum = "0" + mnum;}
    seconds = (now - grt ) / 1000 - (24 * 60 * 60 * dnum) - (60 * 60 * hnum) - (60 * mnum);
    snum = Math.round(seconds);
    if(String(snum).length ==1 ){snum = "0" + snum;}
    // var times = document.getElementById("times").innerHTML = hnum + " 小时 " + mnum + " 分 " + snum + " 秒";
    document.getElementById("timeDate").innerHTML = "本站已安全运行 "+dnum+" 天 "+hnum + " 小时 " + mnum + " 分 " + snum + " 秒";
    }
    setInterval("createtime()",250);
    </script>
  7. 添加live-2d。
    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
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    // 1. 安装插件
    npm install -save hexo-helper-live2d

    // 2. 安装模型
    npm install live2d-widget-model-wanko --save

    // 可选择其他模型
    # live2d-widget-model-chitose

    # live2d-widget-model-epsilon2_1

    # live2d-widget-model-gf

    # live2d-widget-model-haru/01 (use npm install --save live2d-widget-model-haru)

    # live2d-widget-model-haru/02 (use npm install --save live2d-widget-model-haru)

    # live2d-widget-model-haruto

    # live2d-widget-model-hibiki

    # live2d-widget-model-hijiki

    # live2d-widget-model-izumi

    # live2d-widget-model-koharu

    # live2d-widget-model-miku

    # live2d-widget-model-ni-j

    # live2d-widget-model-nico

    # live2d-widget-model-nietzsche

    # live2d-widget-model-nipsilon

    # live2d-widget-model-nito

    # live2d-widget-model-shizuku

    # live2d-widget-model-tororo

    # live2d-widget-model-tsumiki

    # live2d-widget-model-unitychan

    # live2d-widget-model-wanko

    # live2d-widget-model-z16

    // 3. 站点配置文件_config.yml添加以下代码
    live2d:
    enable: true
    scriptFrom: local
    pluginRootPath: live2dw/
    pluginJsPath: lib/
    pluginModelPath: assets/
    tagMode: false
    log: false
    model:
    use: live2d-widget-model-<模型名字>
    display:
    position: right
    # width: 150 # 大小根据模型结构自己调整合适的
    # height: 300
    mobile:
    show: false # 是否在手机端显示
  8. 背景图片设:将背景图放到source/images下,然后styles.styl中添加以下样式
    1
    2
    3
    4
    5
    6
    7
    body {
    background-image: url(../images/background.png);
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: 100% 100%;
    opacity: 0.8;
    }