搭建 Firekylin 博客 && Valine 评论

安装 Firekylin

基于 CentOS 7.2(理论上通用)

Firekylin 需要 Node 8.9.4+ 和 MySQL 环境的支持,请确保服务器上安装了相关环境

安装 Nginx 服务

1
yum install nginx -y

安装 Node.js

1
yum install nodejs -y

安装 PM2 进程管理

1
yum install -g pm2

下载 Firekylin

1
2
3
wget https://firekylin.org/release/latest.tar.gz
tar zxvf latest.tar.gz
cd firekylin

安装依赖程序

1
npm install --registry=https://registry.npm.taobao.org

配置 pm2.json

1
2
cp pm2_default.json pm2.json
vim pm2.json

修改 cwd 为 firekyllin 路径

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"apps": [{
"name": "firekylin",
"script": "production.js",
"cwd": "/webdata/firekylin",
"exec_mode": "fork",
"max_memory_restart": "1G",
"autorestart": true,
"node_args": [],
"args": [],
"env": {

}
}]
}

启动项目 && 设置为自启动

1
2
pm2 startOrReload pm2.json
pm2 startup

配置 nginx.conf

1
2
cp nginx_default.conf nginx.conf
vim nginx.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
server {
listen 80;
server_name blog.inonly.cc; #改为你解析过的域名
root /webdata/firekylin; #firekylin 的路径
set $node_port 8360;

index index.js index.html index.htm;

location ^~ /.well-known/acme-challenge/ {
alias /Users/welefen/Develop/git/firekylin/ssl/challenges/;
try_files $uri = 404;
}

location / {
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:$node_port$request_uri;
proxy_redirect off;
}

location = /development.js {
deny all;
}
location = /testing.js {
deny all;
}

location = /production.js {
deny all;
}


#location ~ /static/ {
# etag on;
# expires max;
#}
}

将 nginx.conf 软链到 nginx 配置目录下

1
2
ln -s /webdata/firekylin/nginx.conf /etc/nginx/conf.d/firekylin.conf
systemctl restart nginx

配置 Valine

详细教程请移步:https://ioliu.cn/2017/add-valine-comments-to-your-blog/

评论代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='//unpkg.com/valine/dist/Valine.min.js'></script>
<script>
new Valine({
el: '#comments' ,
notify:false,
verify:false,
guest_info:['nick','mail','link'],
appId: 'your appid',
appKey: 'your appkey',
placeholder: 'ヾノ≧∀≦)o来啊,快活啊!',
path:window.location.pathname,
avatar:'retro'
});
</script>

更多

Firekylin主页:https://firekylin.org

Valine主页:https://valine.js.org

------------- 本文结束  感谢您的阅读 -------------
0%