之前多说凉了,后来陆续尝试过多个评论系统,友言、网易都不理想,于是找到了Isso这个Python写的开源评论系统,话不多说,下面开始搭建。
环境部署
Python我使用的是3.7,关于centos多个Python版本共存,在前面已经讲过了
然后要安装并更新pip,已经是最新pip的可以忽略不计
yum -y install epel-release
yum install python-pip
pip install --upgrade pip
安装Isso
一条命令搞定:
pip install isso
报错 "fatal error: Python.h: No such file or directory",需要安装python-devel
yum install python-devel
重新安装,出现如下信息,安装成功
Running setup.py install for misaka ... done
Running setup.py install for ipaddr ... done
Running setup.py install for configparser ... done
Running setup.py install for isso ... done
Successfully installed bleach-3.0.2 configparser-3.5.0 html5lib-1.0.1 ipaddr-2.2.0 isso-0.11.1 misaka-2.1.0 webencodings-0.5.1 werkzeug-0.14.1
安装 SQLite3
Isso使用SQLite3数据库,这里选择一键安装,想要自定义安装可以Google
yum install sqlite-devel
创建数据库目录(假设将数据库存放在/data/db/sqlite/isso/comments.db)
/data/db/sqlite/isso/
创建配置文件/etc/isso.conf,保存如下配置:
[general]
dbpath = /data/db/sqlite/isso/comments.db
host = https://comments.qfcoder.com/
[server]
listen = http://localhost:8090/
[moderation]
enabled = false
配置isso
编辑 /etc/isso.conf 文件,以下是最基本的配置,具体自定义配置可以google一下:
[general]
dbpath = /var/lib/isso/comments.db
host = https://qfcoder.com/
https://www.qfcoder.com/
[server]
listen = http://localhost:8090/
[moderation]
enabled = false
保存后可以启动试试:
isso -c /etc/isso.conf run
设置http代理
程序可以启动了,接下来需要配置http代理,将http或https请求代理到isso服务,这里使用默认的8090端口,并且以apache为例,直接在域名配置中加入以下内容:
ProxyPass /isso http://localhost:8090
ProxyPassReverse /isso http://localhost:8090
配置完成后重启apache即可
添加systemd服务进程
为了便于管理,可以将isso加入systemd服务,创建isso.service文件并编辑:
vi /etc/systemd/system/isso.service
编辑以下内容
[Unit]
Description=isso Server
After=network.target
After=syslog.target
[Service]
Type=simple
LimitNOFILE=65535
ExecStart=isso -c /etc/isso.conf run
ExecReload=/bin/kill -USR1 $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target graphical.target
页面中引用评论
只需要在网页中任意位置引用如下代码即可:
<script data-isso="https://comments.qfcoder.com/isso/" src="https://comments.qfcoder.com/isso/js/embed.min.js"></script>
<section id="isso-thread"></section>
其中的域名就是前面配置的代理主机
isso支持很丰富的自定义配置,具体可以网上查找,这里不细说
本教程参考 https://sb.sb/blog/debian-ubuntu-install-isso/