导航
导航
文章目录
  1. 一、Isso 服务端
    1. 1.1 自定义配置文件
    2. 1.2 docker-compose.yml
  2. 二、Nginx 配置(选做)
  3. 三、客户端引入 Isso
    1. 3.1 一般设置
    2. 3.2 Hexo 设置

Hexo 使用 Isso 评论系统

Isso 是基于 Python 写的一套开源评论系统,可以使用 docker 来部署,其安装配置都非常简单,是目前替换 Disqus 的不二选择。

官方主页:https://posativ.org/isso/
Docker 项目: https://hub.docker.com/r/wonderfall/isso/

一、Isso 服务端

1.1 自定义配置文件

下面选项需要修改,更多解释请参考官方文档 Server Configuration

  • host 是你引用 Isso 的 JS 的网站地址,需要写全。
  • smtp 发送评论到你邮箱以及审核评论
vim /opt/isso/config/isso.conf
[general]
dbpath = /db/comments.db
host = https://blog.wangyan.org/
max-age = 1d
notify = smtp

[moderation]
enabled = false
purge-after = 30d

[server]
listen = http://0.0.0.0:8080/

[smtp]
username = noreply@wangyan.org
password = xxxx
host = smtp.exmail.qq.com
port = 25
security = none
to = service@wangyan.org
from = "WangYan BLog" <noreply@wangyan.org>
timeout = 10

[guard]
enabled = true
ratelimit = 5
direct-reply = 10
reply-to-self = false
require-author = true
require-email = true

[markup]
options = strikethrough, superscript, autolink
allowed-elements = img
allowed-attributes = src

1.2 docker-compose.yml

vim /opt/isso/docker-compose.yml 
isso:
    image: wonderfall/isso
    container_name: isso
    environment:
        - GID=1000
        - UID=1000
    ports:
        - "8080:8080"
    volumes:
        - /opt/isso/config:/config
        - /opt/isso/db:/db
    restart: always

最后运行 docker-compose up -d 就 OK 了。

二、Nginx 配置(选做)

为了网址好看些,比如说 isso.wangyan.org 还需要配置 Nginx

server {
    listen 80;
    server_name isso.wangyan.org;

    location / {
        proxy_pass http://127.0.0.1:8080;
        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 https;
    }
}

server {
    listen 443 ssl http2;
    server_name isso.wangyan.org;

    ssl on;
    ssl_certificate  /etc/nginx/ssl/isso.wangyan.org.pem;
    ssl_certificate_key /etc/nginx/ssl/isso.wangyan.org.key;
    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_prefer_server_ciphers on;

    location / {
        proxy_pass http://127.0.0.1:8080;
        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 https;
    }
}

三、客户端引入 Isso

3.1 一般设置

在页面的适当位置放下面一段代码

<script data-isso="https://blog.wangyan.org/"
        data-isso-css="true"
        data-isso-reply-to-self="false"
        data-isso-require-author="true"
        data-isso-require-email="true"
        data-isso-max-comments-top="100"
        data-isso-max-comments-nested="5"
        data-isso-reveal-on-click="10"
        data-isso-avatar="true"
        data-isso-avatar-bg="#f0f0f0"
        data-isso-avatar-fg="#9abf88 #5698c4 #e279a3 #9163b6 ..."
        data-isso-vote="false"
        src="https://blog.wangyan.org/js/embed.min.js"></script>

<section id="isso-thread"></section>

3.2 Hexo 设置

如果是 hexo 可以这样(不同主题放置方法不一样)

编辑主题配置文件 _config.yml

isso_url: //isso.wangyan.org/

编辑 layout/_partial/component/comments.ejs 加入一行

 <%- partial('isso') %>

最后引入 isso.ejs

/* layout/_partial/component/isso.ejs */

<% if (theme.isso_url){ %>
<script data-isso="<%= theme.isso_url %>"
        data-isso-css="true"
        data-isso-reply-to-self="false"
        data-isso-require-author="true"
        data-isso-require-email="true"
        data-isso-max-comments-top="100"
        data-isso-max-comments-nested="5"
        data-isso-reveal-on-click="10"
        data-isso-avatar="true"
        data-isso-avatar-bg="#f0f0f0"
        data-isso-avatar-fg="#9abf88 #5698c4 #e279a3 #9163b6 ..."
        data-isso-vote="false"
        src="<%= theme.isso_url %>js/embed.min.js"></script>

<section id="isso-thread"></section>
<% } %>

参考文档:

支持一下
扫一扫,支持一下