RSSHub Miniflux 搭建

警告
本文最后更新于 2023-01-23,文中内容可能已过时。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 卸载旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install -y vim ca-certificates curl gnupg lsb-release

# 添加 Docker 源
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# 安装 Docker
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin

# 测试是否安装成功
sudo docker run hello-world
docker --version
  1. 准备配置文件。
1
vim docker-compose.yml
  1. 填入以下内容。
 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
version: '4.0'

services:

  miniflux:
    image: miniflux/miniflux:latest
    container_name: miniflux
    restart: unless-stopped
    ports:
      - "8888:8080" # 8888 为自定义端口
    depends_on:
      - db
      - rsshub
    environment:
      - DATABASE_URL=postgres://miniflux:secret@db/miniflux?sslmode=disable
      - RUN_MIGRATIONS=1
      - CREATE_ADMIN=1
      - ADMIN_USERNAME=admin   # 自定义用户名
      - ADMIN_PASSWORD=test123 # 自定义密码

  db:
    image: postgres:latest
    container_name: postgres
    restart: unless-stopped
    environment:
      - POSTGRES_USER=miniflux   # 可修改,需和 DATABASE_URL 中对应
      - POSTGRES_PASSWORD=secret # 可修改,需和 DATABASE_URL 中对应
    volumes:
      - miniflux-db:/var/lib/postgresql/data
    healthcheck:
      test: [ "CMD", "/usr/bin/miniflux", "-healthcheck", "auto" ]
      interval: 10s
      start_period: 30s

  rsshub:
    image: diygod/rsshub:chromium-bundled
    container_name: rsshub
    restart: unless-stopped
    ports:
      - '1200:1200'
    environment:
      NODE_ENV: production
      CACHE_TYPE: redis
      REDIS_URL: 'redis://redis:6379/'
      PUPPETEER_WS_ENDPOINT: 'ws://browserless:3000'
    depends_on:
      - redis
      - browserless

  browserless:
    image: browserless/chrome:latest
    container_name: browserless
    restart: unless-stopped
    ulimits:
      core:
        hard: 0
        soft: 0

  redis:
    image: redis:alpine
    container_name: redis
    restart: unless-stopped
    volumes:
      - redis-data:/data

volumes:
  miniflux-db:
  redis-data:
  1. 启动容器。
1
2
3
4
# 启动
docker compose up -d
# 查看容器状态,STATUS 显示正常即可
docker ps -a
  1. 配置。
    • 访问http://ip:port,输入刚才自定义的用户名和密码。
    • 设置里启动 fever,然后设置用户名和密码。
  1. 安装acme.sh
  1. 注册 cloudflare 并将域名解析到 cloudflare。

  2. 获取 cloudflare 的 Global API Key。

1
2
export CF_Key="3a...08"          # 替换为 Global API Key
export CF_Email="test@gmail.com" # 替换为 cloudflare 的注册邮箱
  1. acme.sh使用 cloudflare 的 DNS API 申请泛域名证书,任意二级域名都可以使用。将域名换成自己的域名。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 申请证书
acme.sh --issue --dns dns_cf -d backtraxe.top -d "*.backtraxe.top"

# 创建目录
mkdir -p /etc/nginx/ssl/backtraxe.top

# 复制证书到指定目录
acme.sh --install-cert -d backtraxe.top \
--key-file /etc/nginx/ssl/backtraxe.top/backtraxe.top.key \
--fullchain-file /etc/nginx/ssl/backtraxe.top/fullchain.cer \
--reloadcmd "service nginx force-reload"
  1. 配置 Nginx,实现rss.backtraxe.top代理https://127.0.0.1:8888rsshub.backtraxe.top代理https://127.0.0.1:1200
 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 443 ssl;
    server_name rsshub.backtraxe.top;

    ssl_certificate "/etc/nginx/ssl/backtraxe.top/fullchain.cer";
    ssl_certificate_key "/etc/nginx/ssl/backtraxe.top/backtraxe.top.key";
    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout  10m;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;

    location / {
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:1200;
    }
}

server {
    listen 443 ssl;
    server_name rss.backtraxe.top;

    ssl_certificate "/etc/nginx/ssl/backtraxe.top/fullchain.cer";
    ssl_certificate_key "/etc/nginx/ssl/backtraxe.top/backtraxe.top.key";
    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout  10m;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;

    location / {
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:8888;
    }
}

server {
    listen 80;
    listen [::]:80;

    server_name backtraxe.top;

    return 301 https://$http_host$request_uri;
}

Fever API:

  • url: http://ip:port/fever/
  • username: 自定义 fever 的用户名
  • password: 自定义 fever 的密码
  1. Install Docker Engine on Ubuntu | Docker Documentation
  2. Docker Installation | Miniflux Installation Instructions
  3. 用Miniflux自建轻便好用的RSS服务
  4. Docker Compose 部署 | RSSHub

https://www.psay.cn/toss/126.html https://cloud.tencent.com/developer/article/1840147 https://suzuhafan.com/tutorials/acmesh-use-cloudflare-to-create-ssl.html https://luyuhuang.tech/2020/06/03/cloudflare-free-https.html https://learnku.com/articles/13496/lets-encrypt-pan-domain-name-application-and-configuration https://luyuhuang.tech/2020/06/03/cloudflare-free-https.html https://mincong.io/cn/nginx-subdomains/