自打Google的Reader完蛋之后,我的RSS订阅是从inoreader、抓虾、Feedly来回流浪。后来又用过几个桌面版的阅读器,只不过我因为几个电脑来回倒腾,很快也不知所踪了。这两天看到了TinyRSS的搭建内容,我也正好可以跟着走一遍。

2021年冬 摄于天津

原料

  1. VPS主机 1台
  2. Docker以及可用的镜像
  3. 域名以及公网IP
  4. 使用Awesome TTRSS镜像来配置,而非使用原厂镜像

加工

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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 系统准备
# 修改系统源
sed -e 's|^mirrorlist=|#mirrorlist=|g' -e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g' -i.bak /etc/yum.repos.d/rocky*.repo

# 系统更新
dnf update -y
# 安装常用软件
dnf install -y wget curl zip unzip vim mailx mlocate telnet bash-completion tmux
dnf install -y chrony rsync git screen tree open-vm-tools yum-utils lrzsz

# 安装EPEL
dnf install -y epel-release

# 修改epel源
sed -e 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' -e 's|^metalink=|#metalink=|g' -i.bak /etc/yum.repos.d/epel*

# 刷新缓存
dnf makecache

# 开启网络BBR模块
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p


# 添加软件源信息
dnf config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo

# 更新并安装Docker-CE
dnf makecache
dnf install -y device-mapper-persistent-data lvm2 psmisc net-tools jq
dnf install -y bind-utils python3-dnf-plugin-versionlock
dnf install -y lnav nc lsof ncdu dstat git
dnf remove -y podman*
dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# 锁定版本
dnf versionlock add docker-ce

# 修改内核加载模块
cat > /etc/modules-load.d/containerd.conf <<EOF
overlay
br_netfilter
EOF

# 加载模块
modprobe br_netfilter

cat > /etc/sysctl.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF

# 配置加速源
mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
"group": "docker",
"registry-mirrors": ["https://registry.dockermirror.com"],
"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF

# 重新加载并配置开机启动
systemctl daemon-reload
systemctl enable --now docker

# 获取安桩文件
cd /opt
git clone https://github.com/HenryQW/Awesome-TTRSS.git
cd Awesome-TTRSS
# 注意要修改docker-compose.yml中的数据库DB_PASS密码值
docker compose up -d

前端

默认TInyRss使用181端口来提供服务,我们这里使用Nginx来作为反向代理,并提供Https。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 安装Nginx
cat > /etc/yum.repos/nginx.repo <<EOF
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
EOF

dnf makecache
dnf install -y nginx
systemctl enable --now nginx

新增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
36
37
38
39
# vim /etc/nginx/conf.d/rss.conf
upstream ttrssdev {
server 127.0.0.1:181;
}

server {
listen 80;
server_name rss.sujx.net;
return 301 https://rss.sujx.net$request_uri;
}

server {
listen 443 ssl;
gzip on;
server_name rss.sujx.net;

ssl_certificate /etc/ssl/fullchain.pem;
ssl_certificate_key /etc/ssl/cert.pem;

location / {
proxy_redirect off;
proxy_pass http://ttrssdev;

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;

client_max_body_size 100m;
client_body_buffer_size 128k;

proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}

配置完成DNS域名解析之后,重启Nginx服务

1
2
3
4
# 检查Nginx配置
nginx -t
# 重启服务
systemctl restart nginx

访问

  1. 默认用户名为admin,密码为password

    Login

  2. 导入opml文件

    import

  3. 访问订阅

    Reader