Skip to content

Install on Raspbian GNU Linux 10 (buster) with lighttpd and mariadb

tic226n edited this page Apr 25, 2022 · 4 revisions

A few things have changed since the other install guides for the Raspberry Pi was created. This also includes setup of the mariadb.

Install mariadb, php and lighttpd:

sudo apt install php-mysql php-gd php-cgi php-http php-xml lighttpd mariadb-server mariadb-client

Secure the mariadb installation by running:

sudo mysql_secure_installation

Login to the mariadb console:

sudo mysql -u root -p

In the console create the database and grand privileges to the database user:

create database selfoss;
grant all on selfoss.* to selfoss@localhost identified by 'SECURE_PASSWORD';
\q

Replace 'SECURE_PASSWORD' with a secure password.

Enable fastcgi for php in lighttpd:

sudo /usr/sbin/lighttpd-enable-mod fastcgi fastcgi-php

Change the max_execution_time to 60 in /etc/php/7.4/cgi/php.ini by running this command:

sudo sed -i 's/max_execution_time = .*/max_execution_time = '60'/' /etc/php/7.4/cgi/php.ini

Download and extract selfoss:

wget https://github.com/SSilence/selfoss/releases/download/2.18/selfoss-2.18.zip --directory-prefix=/tmp
sudo mkdir /var/www/html/selfoss
sudo unzip /tmp/selfoss-2.18.zip -d /var/www/html/selfoss/
sudo chown -R www-data:www-data /var/www/html/selfoss/
sudo chmod g+w /var/www/html/selfoss/data/cache /var/www/html/selfoss/data/favicons /var/www/html/selfoss/data/logs /var/www/html/selfoss/data/thumbnails /var/www/html/selfoss/data/sqlite /var/www/html/selfoss/public

Take a copy of the default configuration file:

sudo cp /var/www/html/selfoss/defaults.ini /var/www/html/selfoss/config.ini

Modify the config.ini to have this database configuration:

db_type=mysql
db_host=localhost
db_database=selfoss
db_username=selfoss
db_password='SECURE_PASSWORD'
db_port=3306
db_prefix=

Replace 'SECURE_PASSWORD' with the secure password you created when creating the database in the database console.

Edit /var/www/html/selfoss/.htaccess uncomment "RewriteBase /selfoss"

Edit /etc/lighttpd/lighttpd.conf: in server.modules uncomment/add "mod_rewrite" Also add these rewrite rules:

url.rewrite-once += (
"^/selfoss/favicon.ico$" => "/selfoss/public/favicon.ico",
 "^/selfoss/favicons/(.*)$" => "/selfoss/data/favicons/$1",
 "^/selfoss/thumbnails/(.*)$" => "/selfoss/data/thumbnails/$1",
 "^/selfoss/([^\?]*.(js|ico|gif|jpg|png|css|asc|txt|eot|woff|ttf|svg))(\?.*)?$" => "/selfoss/public/$1",
 "^/selfoss/index.php(.*)$" => "$0",
 "^/selfoss/([^\?]*)(\?(.*))?" => "/selfoss/index.php?$3",
 "^/selfoss/public/" => "$0",
 "^/selfoss/(.*)" => "/selfoss/index.php$1"
)

Setup a cron job to automatically update feeds by running:

sudo crontab -e

Add this line to the crontab and save and quit:

*/15 * * * * curl --silent --show-error -m 3300 -k https://127.0.0.1/selfoss/update >>/var/log/selfoss_update.log > /dev/null

Restart lighttpd:

sudo service lighttpd restart

Open selfoss in your web browser by going to http://{host-ip-address}/selfoss The first run may give a timeout error whilst it sets up the environment. From then on it should work fine.