欢迎来到 HestiaCP 系列教程的最新篇章。从这里开始,我们将专注于精简的关键内容,为你快速核心操作。

如果你希望了解更多详细的使用方法和操作技巧,建议你回顾之前的系列文章。每一篇文章都通过一个自建软件来介绍具体的操作步骤,例如:Ghost 的部署教程展示了如何在 HestiaCP 上使用 Node.js,qBittorrent 的教程讲解了如何通过 Nginx 进行反向代理,Vaultwarden 的教程演示了如何在 HestiaCP 上部署 Docker 应用,Nestcloud 的教程则说明了如何部署 PHP 项目。

HestiaCP - HOSTEYE

安装 RSSHub

如果想利用HestiaCP强大的备份恢复功能,你可以在/home/user/web/domain/public_html/下新建docker-compose.yml文件。

总之,填入一下内容:

services:
    rsshub:
        # two ways to enable puppeteer:
        # * comment out marked lines, then use this image instead: diygod/rsshub:chromium-bundled
        # * (consumes more disk space and memory) leave everything unchanged
        image: diygod/rsshub
        restart: always
        ports:
            - "1200:1200" #自行修改端口
        environment:
            NODE_ENV: production
            CACHE_TYPE: redis
            REDIS_URL: "redis://:passwd@host:6379/" #自行修改
            PUPPETEER_WS_ENDPOINT: "ws://browserless:3000" # marked

            # PIXIV_REFRESHTOKEN:    类似的其他配置,请参考官方文档进行设置。

        healthcheck:
            test: ["CMD", "curl", "-f", "http://localhost:1200/healthz"]
            interval: 30s
            timeout: 10s
            retries: 3
        depends_on:
            - browserless # marked

    browserless: # marked
        image: browserless/chrome # marked
        restart: always # marked
        ulimits: # marked
            core: # marked
                hard: 0 # marked
                soft: 0 # marked
        healthcheck:
            test: ["CMD", "curl", "-f", "http://localhost:3000/pressure"]
            interval: 30s
            timeout: 10s
            retries: 3

Nginx 反代

HestiaCP 的反向代理配置离不开模板。下面我提供了两份模板,供你参考和修改:

.tpl

#=========================================================================
# Default Web Domain Template
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS
# https://hestiacp.com/docs/server-administration/web-templates.html
#=========================================================================

server {
	listen      %ip%:%proxy_port%;
	server_name %domain_idn% %alias_idn%;
	error_log   /var/log/%web_system%/domains/%domain%.error.log error;

	include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;

    location ~ /.well-known {
        allow all;
    }

	location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:1200;

	}



	include %home%/%user%/conf/web/%domain%/nginx.conf_*;
}

.stpl

#=========================================================================
# Default Web Domain Template
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS
# https://hestiacp.com/docs/server-administration/web-templates.html
#=========================================================================

server {
	listen      %ip%:%proxy_ssl_port% ssl;
	server_name %domain_idn% %alias_idn%;
	error_log   /var/log/%web_system%/domains/%domain%.error.log error;

	ssl_certificate     %ssl_pem%;
	ssl_certificate_key %ssl_key%;
	ssl_stapling        on;
	ssl_stapling_verify on;

	# TLS 1.3 0-RTT anti-replay
	if ($anti_replay = 307) { return 307 https://$host$request_uri; }
	if ($anti_replay = 425) { return 425; }

	include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;

    location ~ /.well-known {
        allow all;
    }

	location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:1200;

	}


	proxy_hide_header Upgrade;

	include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
}

安装 Tiny Tiny RSS

这里我们选择部署 Awesome TTRSS 。它为我们提供一站式容器化 Tiny Tiny RSS 解决方案,简化部署并集成额外插件。

🐋 Awesome TTRSS
🐋 一个「容器化」的 Tiny Tiny RSS 一站式解决方案。

写入配置文件

这里我们为了利用HestiaCP强大的备份恢复功能,选择连接宿主机的pgsql:

如果遇到问题,请参考这篇文章

HestiaCP + Portainer:轻松管理所有 Docker 应用
安装 Portainer 安装docker就不再赘述了。 创建 Portainer Server 用于存储其数据库的卷: docker volume create portainer_data 然后,下载并安装 Portainer Server 容器: docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:2.21.4 Nginx 反代
version: "3"
services:
  service.rss:
    image: wangqiru/ttrss:latest
    container_name: ttrss
    ports:
      - 1008:80
    environment:
      - SELF_URL_PATH=https://xxx.com # 请将其更改为您自己的域名
      - PUID=1000  # 请对应修改
      - PGID=1000  # 请对应修改
      - DB_TYPE=pgsql
      - DB_HOST=172.17.0.1
      - DB_PORT=5432
      - DB_NAME=xxxx
      - DB_USER=xxxx
      - DB_PASS=xxxxxxxx
    volumes:
      - /home/user/web/domain/public_html/feed-icons/:/var/www/feed-icons/
    networks:
      - public_access
      - service_only
    stdin_open: true
    tty: true
    restart: always

  service.mercury: # 在 TTRSS 插件设置页面将 Mercury Parser API 端点设置为 `service.mercury:3000`
    image: wangqiru/mercury-parser-api:latest
    container_name: mercury
    networks:
      - public_access
      - service_only
    restart: always

  service.opencc: # 在 TTRSS 插件设置页面将 OpenCC API 端点设置为 `service.opencc:3000`
    image: wangqiru/opencc-api-server:latest
    container_name: opencc
    environment:
      - NODE_ENV=production
    networks:
      - service_only
    restart: always


  # utility.watchtower:                                   自行选择是否开启
  #   container_name: watchtower
  #   image: containrrr/watchtower:latest
  #   volumes:
  #     - /var/run/docker.sock:/var/run/docker.sock
  #   environment:
  #     - WATCHTOWER_CLEANUP=true
  #     - WATCHTOWER_POLL_INTERVAL=86400
  #   restart: always

volumes:
  feed-icons:

networks:
  public_access: # 提供对 ttrss 用户界面的访问
  service_only: # 仅用于服务之间的通信网络
    internal: true

Nginx 反代

.tpl

#=========================================================================
# Default Web Domain Template
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS
# https://hestiacp.com/docs/server-administration/web-templates.html
#=========================================================================

server {
	listen      %ip%:%proxy_port%;
	server_name %domain_idn% %alias_idn%;
	error_log   /var/log/%web_system%/domains/%domain%.error.log error;

	include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;

    location ~ /.well-known {
        allow all;
    }

	location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:1008;

	}



	include %home%/%user%/conf/web/%domain%/nginx.conf_*;
}

.stpl

#=========================================================================
# Default Web Domain Template
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS
# https://hestiacp.com/docs/server-administration/web-templates.html
#=========================================================================

server {
	listen      %ip%:%proxy_ssl_port% ssl;
	server_name %domain_idn% %alias_idn%;
	error_log   /var/log/%web_system%/domains/%domain%.error.log error;

	ssl_certificate     %ssl_pem%;
	ssl_certificate_key %ssl_key%;
	ssl_stapling        on;
	ssl_stapling_verify on;

	# TLS 1.3 0-RTT anti-replay
	if ($anti_replay = 307) { return 307 https://$host$request_uri; }
	if ($anti_replay = 425) { return 425; }

	include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;

    location ~ /.well-known {
        allow all;
    }

	location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:1008;

	}


	proxy_hide_header Upgrade;

	include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
}

Mercury 全文获取

全文内容提取插件,配合单独的 Mercury Parser API 服务器使用。Awesome TTRSS样例 Docker Compose 中已经包含了 HenryQW/mercury-parser-api 服务器。

设置步骤

  1. 在设置中启用 mercury-fulltext 插件
  1. 在设置中填入 Mercury Parser API 地址
  1. 示例按钮

OpenCC 繁简转换 

使用 OpenCC 为 TTRSS 提供中文繁转简的插件,需要配合单独的 OpenCC API 服务器使用。Awesome TTRSS样例 Docker Compose 中已经包含了 HenryQW/OpenCC.henry.wang 服务器。

设置步骤

  1. 在设置中启用 opencc 插件 
  1. 在设置中填入 OpenCC API 地址
  1. 示例按钮

更换主题

安装 Miniflux

如果你觉得ttrss有点臃肿,那么你可以试试miniflux

写入配置文件

这里我们为了利用HestiaCP强大的备份恢复功能,依然选择连接宿主机的pgsql:

services:
  miniflux:
    image: miniflux/miniflux:latest
    ports:
      - "1009:8080"
    environment:
      - DATABASE_URL=postgres://<DB_USER>:<DB_PASSWORD>@<DB_HOST>:<DB_PORT>/<DB_NAME>?sslmode=disable  #自行修改
      - RUN_MIGRATIONS=1
      - CREATE_ADMIN=1
      - ADMIN_USERNAME=admin
      - ADMIN_PASSWORD=passwd   #自行修改

Nginx 反代

.tpl

#=========================================================================
# Default Web Domain Template
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS
# https://hestiacp.com/docs/server-administration/web-templates.html
#=========================================================================

server {
	listen      %ip%:%proxy_port%;
	server_name %domain_idn% %alias_idn%;
	error_log   /var/log/%web_system%/domains/%domain%.error.log error;

	include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;

    location ~ /.well-known {
        allow all;
    }

	location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:1009;

	}



	include %home%/%user%/conf/web/%domain%/nginx.conf_*;
}

.stpl

#=========================================================================
# Default Web Domain Template
# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS
# https://hestiacp.com/docs/server-administration/web-templates.html
#=========================================================================

server {
	listen      %ip%:%proxy_ssl_port% ssl;
	server_name %domain_idn% %alias_idn%;
	error_log   /var/log/%web_system%/domains/%domain%.error.log error;

	ssl_certificate     %ssl_pem%;
	ssl_certificate_key %ssl_key%;
	ssl_stapling        on;
	ssl_stapling_verify on;

	# TLS 1.3 0-RTT anti-replay
	if ($anti_replay = 307) { return 307 https://$host$request_uri; }
	if ($anti_replay = 425) { return 425; }

	include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;

    location ~ /.well-known {
        allow all;
    }

	location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://127.0.0.1:1009;

	}


	proxy_hide_header Upgrade;

	include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
}

包含的标签:

教程, HestiaCP

最后更新: October 29, 2024