RSSHub is a highly customizable, self-hosted RSS feed generator that enables users to aggregate content from virtually any website. Perfect for developers and tech-savvy users, it empowers you to create and control your own RSS feeds, offering incredible flexibility and privacy. This guide will walk you through installing RSSHub, configuring a reverse proxy with Nginx, managing logs, setting up backups, performing updates, and leveraging its unique features to get the most out of your setup.
Installing RSSHub
📦 Docker/Docker Compose Setup
Docker is the easiest way to deploy RSSHub. Below is a docker-compose.yml
file tailored for RSSHub. This setup maps port 1200
for access, includes basic configurations, and ensures persistent storage.
version: "3.8"
services:
rsshub:
image: diygod/rsshub
container_name: rsshub
ports:
- "1200:1200"
environment:
NODE_ENV: production
CACHE_EXPIRE: 3600
PUPPETEER_WS_ENDPOINT: '' # Optional, for dynamic content scraping
volumes:
- ./data:/app/data
restart: unless-stopped
Run the following commands to deploy RSSHub:
mkdir rsshub && cd rsshub
nano docker-compose.yml # Paste the above configuration
docker-compose up -d
🚀 Manual Installation
For a manual setup on a Linux server, install Node.js and Yarn, then configure RSSHub:
sudo apt update && sudo apt install -y curl git build-essential
## Install Node.js
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
## Install Yarn globally
sudo npm install -g yarn
## Clone RSSHub and install dependencies
git clone https://github.com/DIYgod/RSSHub.git
cd RSSHub
yarn install
## Start RSSHub
yarn start
Access RSSHub at http://<server-ip>:1200
.
Configuring Nginx as a Reverse Proxy
🌐 Nginx Configuration
Set up Nginx to route traffic from a domain/subdomain to your RSSHub instance:
server {
listen 80;
server_name rsshub.example.com;
location / {
proxy_pass http://127.0.0.1:1200;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Save the configuration file as /etc/nginx/sites-available/rsshub
and enable it:
sudo ln -s /etc/nginx/sites-available/rsshub /etc/nginx/sites-enabled/
sudo nginx -t # Test configuration
sudo systemctl reload nginx
🔒 SSL/TLS Setup
Secure your instance using Let's Encrypt:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d rsshub.example.com
Renew the certificate automatically by adding this cron job:
echo "0 3 * * * certbot renew --quiet" | sudo tee /etc/cron.d/certbot-renew
🛠️ Testing and Reloading Nginx
Once configured, test and reload Nginx:
sudo nginx -t
sudo systemctl reload nginx
Logging and Debugging RSSHub
🗃️ Enabling Debug Logs
To enable debug-level logs, set the DEBUG_INFO
environment variable in your docker-compose.yml
or .env
file:
environment:
DEBUG_INFO: true
📄 Viewing Logs
For Docker installations, view logs with:
docker logs -f rsshub
For manual installations, check logs in app/logs
:
tail -f app/logs/rsshub.log
🛠️ Troubleshooting Common Issues
Analyze logs for errors like missing dependencies or connection issues. For example:
-
Missing Puppeteer: Ensure
PUPPETEER_WS_ENDPOINT
is correctly configured. -
Network issues: Check proxy/Nginx settings.
📤 Exporting Logs
Forward logs to an external system like ELK Stack using Filebeat:
sudo apt install filebeat
## Configure Filebeat to monitor Docker or filesystem logs
Backup and Restore
🗂️ File-Based Backups
Create a backup of configuration and data directories:
tar czvf rsshub_backup_$(date +%F).tar.gz ./data ./docker-compose.yml
🔄 Database Backups
If RSSHub uses a database for specific configurations, export it:
mysqldump -u root -p rsshub_db > rsshub_db_backup.sql
📅 Automated Backup Scripts
Set up a cron job for periodic backups. For example:
echo "0 2 * * * tar czvf /backups/rsshub_$(date +\%F).tar.gz /path/to/rsshub" | crontab -
Updating and Upgrading RSSHub
⬆️ Updating Docker Images
Pull the latest RSSHub image and restart the container:
docker-compose pull
docker-compose up -d
🛠️ Manual Updates
For manual installs, pull the latest code and dependencies:
cd RSSHub
git pull
yarn install
yarn start
🔍 Checking for Updates
Monitor RSSHub’s GitHub repository for release updates: RSSHub GitHub.
Leveraging RSSHub’s Unique Features
🔧 Enabling APIs
RSSHub comes with an API for retrieving feeds programmatically. Access an example feed using curl
:
curl http://<server-ip>:1200/github/trending/daily
🌟 Advanced Configurations
Adjust environment variables to customize features. For example, enable Redis caching:
environment:
REDIS_URL: redis://localhost:6379
Integrate Puppeteer to scrape websites requiring JavaScript:
environment:
PUPPETEER_WS_ENDPOINT: ws://your-puppeteer-server:3000
Wrapping Up
By following this guide, you’ve successfully installed, configured, and customized RSSHub on your server. The flexibility of self-hosting allows you to take full control of your RSS feeds while ensuring privacy and advanced customization. Dive into the provided code examples and start leveraging RSSHub’s full potential today!