发布于 03月26, 2018
分类于 学习笔记

搭建 Firekylin 博客 && Valine 评论

alt

安装 Firekylin

基于 CentOS 7.2(理论上通用)

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

安装 Nginx 服务

yum install nginx -y

安装 Node.js

yum install nodejs -y

安装 PM2 进程管理

yum install -g pm2

下载 Firekylin

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

安装依赖程序

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

配置 pm2.json

cp pm2_default.json pm2.json
vim pm2.json

修改 cwd 为 firekyllin 路径

{
  "apps": [{
    "name": "firekylin",
    "script": "production.js",
    "cwd": "/webdata/firekylin",
    "exec_mode": "fork",
    "max_memory_restart": "1G", 
    "autorestart": true,
    "node_args": [],
    "args": [],
    "env": {

    }
  }]
}

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

pm2 startOrReload pm2.json
pm2 startup

配置 nginx.conf

cp nginx_default.conf nginx.conf
vim nginx.conf

修改成

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 配置目录下

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/

评论代码

<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

-- EOF --

Comments

Title - Artist
0:00