Hexo Blog优化[05] - 曲线救国,用next主题开waline

背景

没有网络前后端开发经验,没接触过Vue,懒得去研究代码了。看到Next主题支持Waline,还是直接上干脆一点。

安装配置

经过了前面的折腾,Next的安装和配置就非常简单了,按官网一步步来就好了。

  1. 安装NexT主题: NexT Install
  2. 安装Waline-Next: Hexo Waline-Next

Nginx配置调整

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
	location / {
root /home/nginx/srv/http/hexo/public;
index index.html index.htm;
}

# proxy to 8360
location /waline/ {
proxy_pass http://127.0.0.1:8360/;
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;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
# cache
add_header Cache-Control no-cache;
expires 12h;
}

# proxy to 8360
# Solute auth redirect issue
# 如果没有这段,登陆会失败
location /api/ {
proxy_pass http://127.0.0.1:8360;
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;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
# cache
add_header Cache-Control no-cache;
expires 12h;
}

最后

如果想快速的在新机器上用,就把waline的配置放到站点的根目录并存入仓库。