Tiny Tiny RSS

  Last modified on Friday 19 May 2017

PROJECT: Home Server #8 .: Install and self-host an RSS news reader and gain access to news feeds over the web.

Let's go!

Setup: Netbook with IP ADDRESS 192.168.1.88 running the latest stable release of Debian.

0. Pre-install

Tiny Tiny RSS is a PHP application that requires a proxy web server and a database back-end to store content. See PHP + Nginx + PostgreSQL for necessary prerequisite to host TTRSS. [1]

1. Database

Create a new PostgreSQL database to hold the content of RSS feeds. Launch the PostgreSQL interactive console front-end psql as postgres user and create user:www-data [2] and database:ttrss ...

# su -c psql postgres
postgres=# CREATE USER "www-data" WITH PASSWORD 'newpasswd';
postgres=# CREATE DATABASE ttrss WITH OWNER "www-data";
postgres=# GRANT ALL PRIVILEGES ON DATABASE ttrss to "www-data";
postgres=# \quit

1.1 Peer authentication

Later when running the TTRSS update.php script you may run into the error Peer authentication failed for user . Fix: [3] Edit /etc/postgresql/VERSION/main/pg_hba.conf and change peer ...

# "local" is for Unix domain socket connections only
local   all             all                                     peer

... to trust ...

# "local" is for Unix domain socket connections only
local   all             all                                     trust

Reload server ...

# systemctl restart postgresql

2. TTRSS

Clone ttrss repository using Git, and change permissions ...

$ git clone https://tt-rss.org/git/tt-rss.git ttrss
$ cd ttrss
$ chmod -R 777 cache/images cache/js cache/export cache/upload feed-icons lock

3. Nginx

Move ttrss directory into Nginx's document root directory (I use /home/USERNAME/www).

Create a server block (virtual host) for TTRSS. Sample /etc/nginx/sites-available/ttrss [4] configuration ...

server {
    listen 80;
    listen [::]:80;

    root /home/USERNAME/www/ttrss;
    index index.php;

    access_log /var/log/nginx/ttrss_access.log;
    error_log /var/log/nginx/ttrss_error.log info;

    server_name rss.*;

    location / {
        index           index.php;
    }

    location ~ \.php$ {
        try_files $uri = 404; #Prevents autofixing of path which could be used for exploit
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        include /etc/nginx/fastcgi.conf;
    }

}

Alternative: Create a self-signed SSL certificate and configure HTTPS access on port 443.

Save changes and enable block ...

# cd /etc/nginx/sites-enabled
# ln -s /etc/nginx/sites-available/ttrss
# systemctl restart nginx

4. Configure

Example: Configuration for LAN access to the TTRSS hosting server. Modify /etc/hosts on the client ...

192.168.1.88 rss.lan

Navigate to http://rss.lan and configure TTRSS ...

Database type: [select PostgreSQL]
Username: www-data
Password: [database password created earlier]
Database Name: ttrss
Hostname: [leave blank]
Port: 5432
URL: https://rss.lan    ## 'https' if using the SSL certificate option

Press Test configuration, then Initialize database, and finally Save configuration.

Navigate back to rss.lan and log back in with username admin and password password. In the top-right go to Actions->Preferences to make further changes to default settings. Create new user account (vs logging in all the time as admin) and change the default admin password.

5. Updates

Configure TTRSS to periodically update RSS feeds with new content. First, test the included update.php script ...

$ /usr/bin/php /home/USERNAME/www/ttrss/update.php --feeds --quiet

If script returns no errors add a new job to cron to run script periodically ...

$ crontab -e

Example ...

55 * * * * /usr/bin/php /home/USERNAME/www/ttrss/update.php --feeds --quiet

Happy hacking!

Notes

[1]Alternative host setups can replace nginx web server with apache and postgresql database with mysql or sqlite. However the TTRSS community recommends the above combination as the optimal setup for lightweight servers like the Raspberry Pi.
[2]PostgreSQL maintains its own users and passwords, which are separate from the Linux user accounts. It is not required that your PostgreSQL usernames match the Linux usernames. See Practical PostgreSQL database.
[3]Unable to connect to postgresql server
[4]Make TTRSS hosted on a home server accessible from the outside over the web by configuring a dynamic DNS service (I like duckdns.org). See DDNS and OpenWrt for details.

More • ttrssrssnetworkdebianlinux