Professional Guide: Deploying RSSHub on Your VPS with Docker for Seamless Feed Aggregation

This comprehensive tutorial walks you through deploying RSSHub, a powerful RSS feed generator, on your VPS using Docker. We’ll cover…

Professional Guide: Deploying RSSHub on Your VPS with Docker for Seamless Feed Aggregation

This comprehensive tutorial walks you through deploying RSSHub, a powerful RSS feed generator, on your VPS using Docker. We’ll cover preparation, deployment, and optimization in three structured sections.

Part 1: Preparation — Setting Up Your VPS and Environment

1.1 Choose and Configure a VPS

  • VPS Provider: Select a reliable provider (e.g., DigitalOcean, Vultr) with at least 1GB RAM and 20GB storage.
  • OS Choice: Use Ubuntu 22.04 LTS (recommended for Docker compatibility).
  1. Connect to your VPS via SSH:

bash

ssh root@your-vps-ip -p 22

Update the system:

apt update && apt upgrade -y

Create a non-root user (replace your-user with your username):

adduser your-user   
usermod -aG sudo your-user   
su - your-user

1.2 Install Docker and Docker Compose

  • Install Docker:
  • bash
  • curl -fsSL https://get.docker.com | sh sudo systemctl enable --now docker sudo usermod -aG docker $USER # Add your user to the Docker group
  • Install Docker Compose:
  • bash
  • sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose docker-compose --version # Verify installation

1.3 Configure Firewall (UFW)

bash

sudo ufw allow ssh   
sudo ufw allow 80/tcp   
sudo ufw allow 443/tcp   
sudo ufw allow 3000/tcp  # RSSHub default port   
sudo ufw enable   
sudo ufw status

Part 2: Deploying RSSHub with Docker Compose

2.1 Create a Project Directory

bash

mkdir rsshub-deployment && cd rsshub-deployment

2.2 Create a Docker Compose File

Create docker-compose.yml with the following configuration:

yaml

version: '3.8'   
services:   
  rsshub:   
    image: diygod/rsshub:latest  # Use the official RSSHub image   
    container_name: rsshub   
    ports:   
      - "3000:3000"  # Map host port 3000 to container port 3000   
    environment:   
      - NODE_ENV=production   
    restart: always  # Automatically restart on failure   
    volumes:   
      - ./data:/app/data  # Persist data between restarts

2.3 Start the RSSHub Container

bash

docker-compose up -d  # Start in detached mode   
docker ps  # Verify container status

2.4 (Optional) Set Up Nginx with HTTPS

2.4.1 Install Nginx

bash

sudo apt install nginx -y

2.4.2 Create Nginx Config (/etc/nginx/sites-available/rsshub)

nginx

server {   
    listen 80;   
    server_name your-domain.com;  # Replace with your domain   
    return 301 https://$server_name$request_uri;   
}   
server {   
    listen 443 ssl;   
    server_name your-domain.com;   
    ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;   
    ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;   
    include /etc/letsencrypt/options-ssl-nginx.conf;   
    ssl_protocols TLSv1.2 TLSv1.3;   
    location / {   
        proxy_pass http://localhost:3000;   
        proxy_set_header Host $host;   
        proxy_set_header X-Real-IP $remote_addr;   
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;   
    }   
}

2.4.3 Enable HTTPS with Let’s Encrypt

bash

sudo ln -s /etc/nginx/sites-available/rsshub /etc/nginx/sites-enabled/   
sudo nginx -t && sudo systemctl reload nginx   
sudo apt install certbot python3-certbot-nginx   
certbot --nginx -d your-domain.com  # Follow prompts to secure with SSL

Part 3: Verification, Optimization, and Maintenance

3.1 Verify RSSHub Installation

3.2 Optimize Performance

3.2.1 Enable Caching in Nginx

Add to your Nginx location / block:

nginx

proxy_cache_valid 200 1h;  # Cache successful responses for 1 hour   
proxy_cache_bypass $http_pragma $http_authorization;   
proxy_no_cache $http_pragma $http_authorization;

3.2.2 Set Resource Limits (Docker Compose)

Update docker-compose.yml:

yaml

services:   
  rsshub:   
    # ... existing config   
    resources:   
      limits:   
        memory: 512m  # Limit memory to 512MB   
        cpus: "1.0"  # Limit to 1 CPU core

3.3 Automated Updates and Backups

  • Auto-Update Images: Use watchtower:
  • bash
  • docker run -d --name watchtower \ -v /var/run/docker.sock:/var/run/docker.sock \ containrrr/watchtower
  • Backup Data: Schedule regular backups:
  • bash
  • docker exec rsshub tar czvf /tmp/rsshub-backup-$(date +%Y%m%d).tar.gz /app/data

3.4 Monitor and Troubleshoot

  • Check logs:
  • bash
  • docker logs rsshub -f
  • Health check endpoint (add to Nginx):
  • nginx
  • location /health { proxy_pass http://localhost:3000/health; allow all; }

Conclusion

By following this guide, you’ve deployed a scalable, secure, and maintainable RSSHub instance on your VPS. The Docker-based setup ensures ease of management, while Nginx and Let’s Encrypt provide production-grade security and accessibility. For further customization, explore RSSHub’s official documentation to expand feed support for platforms like Medium, Twitter, and more.