Sep 19, 2024 3 min read

Miniflux: The Ultimate Self-Hosting Setup

Miniflux: The Ultimate Self-Hosting Setup
Table of Contents

Miniflux is a lightweight, open-source RSS feed reader designed for simplicity and performance. Its self-hosted nature makes it an excellent choice for users who value privacy, customization, and full control over their data. In this guide, we'll cover how to deploy, configure, and manage Miniflux, with practical, hands-on steps to set it up using Docker or a manual installation, configure Nginx as a reverse proxy, enable logging, create backups, and more.

Installing Miniflux

πŸ“¦ Docker/Docker Compose Setup

To deploy Miniflux with Docker, create a docker-compose.yml file tailored to its requirements. This setup includes PostgreSQL as the database and defines environment variables for seamless configuration.


version: "3.9"

services:

db:

image: postgres:15-alpine

container_name: miniflux_db

environment:

POSTGRES_USER: miniflux

POSTGRES_PASSWORD: securepassword

POSTGRES_DB: miniflux

volumes:

- miniflux_db_data:/var/lib/postgresql/data

restart: always

app:

image: miniflux/miniflux:latest

container_name: miniflux_app

ports:

- "8080:8080"

environment:

DATABASE_URL: postgres://miniflux:securepassword@db/miniflux?sslmode=disable

depends_on:

- db

restart: always

volumes:

miniflux_db_data:

Deploy the application by running the following commands in the same directory containing docker-compose.yml:


docker-compose up -d

This command starts both the PostgreSQL and Miniflux containers in detached mode. Miniflux will be accessible at http://<server-ip>:8080.

πŸš€ Manual Installation

For users who prefer a manual setup on a Linux server, follow these steps:

  1. Install the required dependencies:

sudo apt update && sudo apt install -y postgresql wget

  1. Create a PostgreSQL database and user for Miniflux:

sudo -u postgres psql

CREATE DATABASE miniflux;

CREATE USER miniflux_user WITH PASSWORD 'securepassword';

GRANT ALL PRIVILEGES ON DATABASE miniflux TO miniflux_user;

\q

  1. Download and install the latest Miniflux binary:

wget https://github.com/miniflux/v2/releases/latest/download/miniflux-linux-amd64 -O miniflux

chmod +x miniflux

sudo mv miniflux /usr/local/bin/

  1. Start Miniflux with the necessary environment variables:

DATABASE_URL=postgres://miniflux_user:securepassword@localhost/miniflux?sslmode=disable miniflux

Miniflux will now be running on port 8080.

Configuring Nginx as a Reverse Proxy

🌐 Nginx Configuration

Set up Nginx to route traffic to Miniflux running on port 8080. Create a new server block file for Miniflux (e.g., /etc/nginx/sites-available/miniflux):


server {

listen 80;

server_name your-domain.com;

location / {

proxy_pass http://localhost:8080;

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;

}

}

Enable the configuration and reload Nginx:


sudo ln -s /etc/nginx/sites-available/miniflux /etc/nginx/sites-enabled/

sudo nginx -t && sudo systemctl reload nginx

πŸ”’ SSL/TLS Setup

Secure your Miniflux instance with Let's Encrypt by using Certbot:


sudo apt install -y certbot python3-certbot-nginx

sudo certbot --nginx -d your-domain.com

Set up automatic certificate renewals by adding this to your crontab:


0 0 * * * certbot renew --quiet

Logging and Debugging Miniflux

πŸ—ƒοΈ Enabling Debug Logs

Enable debug logging in Miniflux by setting the DEBUG environment variable:


DEBUG=1 DATABASE_URL=postgres://miniflux_user:securepassword@localhost/miniflux?sslmode=disable miniflux

πŸ“„ Viewing Logs

For Docker deployments, view logs using the following command:


docker logs miniflux_app

If running manually, Miniflux logs are output to the terminal where it’s started.

πŸ› οΈ Troubleshooting Common Issues

Check the Miniflux logs for errors like "cannot connect to the database." Ensure the DATABASE_URL environment variable is correctly configured and the database is accessible.

πŸ“€ Exporting Logs

To forward logs to an external log management system, use tools like fluentd or filebeat to collect and forward output from the Docker container or logs from your server.

Backup and Restore

πŸ—‚οΈ File-Based Backups

Backup your docker-compose.yml file and application data volume:


tar -czvf miniflux_backup.tar.gz /path/to/docker-compose.yml /var/lib/docker/volumes/miniflux_db_data

πŸ”„ Database Backups

For a PostgreSQL database, run:


docker exec -t miniflux_db pg_dumpall -c -U miniflux > miniflux_backup.sql

Restore the backup with:


cat miniflux_backup.sql | docker exec -i miniflux_db psql -U miniflux

πŸ“… Automated Backup Scripts

Set up a cron job to back up the database daily:


echo "0 2 * * * docker exec -t miniflux_db pg_dumpall -c -U miniflux > /path/to/backups/miniflux_backup_$(date +\%F).sql" | crontab -

Updating and Upgrading Miniflux

⬆️ Updating Docker Images

Update Miniflux to the latest version with:


docker-compose pull

docker-compose up -d

πŸ› οΈ Manual Updates

If installed manually:

  1. Download the latest Miniflux binary.

  2. Replace the existing binary and restart the app.

πŸ” Checking for Updates

Visit the Miniflux GitHub releases page to monitor for new updates.

Leveraging Miniflux’s Unique Features

πŸ”§ Enabling APIs

Activate the Miniflux API by generating an API token in the web UI under "Settings." Use this token for API requests:


curl -H "X-Auth-Token: your-token" https://your-domain.com/v1/feeds

🌟 Advanced Configurations

Enable custom feed filters or integrations by modifying the environment variables in docker-compose.yml. For example:


environment:

BASE_URL: "https://your-domain.com"

POLLING_FREQUENCY: "1h"

Wrapping Up

By following this guide, you've deployed, configured, and secured your self-hosted Miniflux instance. With full control over your RSS feed reader, you can customize its functionality, securely manage your data, and take advantage of its lightweight yet powerful features. Start exploring Miniflux today and enjoy a fast, privacy-focused RSS reading experience!

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Selfhosted Ninja.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.