Crony Akatsuki

miniflux setup on debian

30-11-2022

| self-host | rss


Looking for a minimal self-hosted feed reader I found miniflux. But trying to set it up I found my self trying to set it up for 3 freaking hours since I only recently started to self-host things. So here I will try to explaing it in the most easy way how to set it up on a debian server with https using certbot and nginx.

For this tutorial I expect that you already have a server seted up with nginx and certbot. To set up this things check out landchad

Installing needed packages

You will first need to setup miniflux apt repository to install it on your system.

echo "deb [trusted=yes] https://repo.miniflux.app/apt/ /" | sudo tee /etc/apt/sources.list.d/miniflux.list > /dev/null
apt update

Then just install the needed packages.

apt install miniflux postgresql

Setting up postgres database and miniflux

Here I will detail steps to create the postgres database.

Initial postgres setup

# Switch to the postgres user
$ su - postgres

# Creating a miniflux user, enter a safe and secure password
$ createuser -P miniflux

# Create a database for miniflux that belongs to our user
$ createdb -O miniflux miniflux

# Create a database for miniflux that belongs to our user
$ createdb -O miniflux miniflux

# Creating extension hstore as superuser
$ psql miniflux -c 'create extension hstore'

# Managing the miniflux database
$ psql $MINIFLUX_DATABASE

# Giving miniflux user all privileges
> alter user miniflux with superuser;

# Exit the postgres database
> \q

# Exit postgres user
$ exit

Miniflux configuration file

Open the miniflux configuration file in path /etc/miniflux.conf and edit it like this.

# See https://miniflux.app/docs/configuration.html
LISTEN_ADDR=127.0.0.1:8080
DATABASE_URL=user=miniflux password=PASSWORD_HERE dbname=miniflux sslmode=disable
RUN_MIGRATIONS=1

Migrating the database and removing superuser privileges in postgres

Now we will migrate the database and remove unneded superuser privileges, since it is reccomended in the miniflux documentation.

# Migrating the database
$ miniflux -c /etc/miniflux.conf -migrate

# Creating miniflux admin user
$ miniflux -c /etc/miniflux.conf -create-admin

# Restarting the systemctl service
$ systemctl restart miniflux

# Entering postgres database user
$ su - postgres

# Entering miniflux database
$ psql $MINIFLUX_DATABASE

# Removing unneded superuser privileges from miniflux user
> alter user miniflux with nosuperuser;

# Exit the postgres database
> \q

# Exit postgres user
$ exit

Nginx and certbot setup

Make sure to have a domain to use for your miniflux setup.

Create and open a nginx config with path /etc/nginx/sites-available/miniflux.conf and add this

server {
    server_name     your.domain.ext;
    listen          80;
    listen          [::]:80;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_redirect off;
        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;
    }
}

Now just link the config to enabled sites and restart nginx service.

$ ln -s /etc/nginx/sites-available/miniflux.conf /etc/nginx/sites-enabled/miniflux.conf
$ systemctl restart nginx

To get https on your domain you just need to run certbot --nginx same as in this tutorial

Finishing words

I hope that this wasn’t hard to follow and shouldn’t take hours like it took me first time I tried to set this all up.