Skip to content

Installing on Raspberry Pi with lighttpd

Jan Tojnar edited this page Mar 2, 2020 · 7 revisions

The Raspberry Pi is a great device for running simple web services as it uses only a few watts of electricity and can be kept running all the time. Selfoss performs very well on the device due to Selfoss's efficient code, unlike Tiny Tiny RSS which doesn't run fast enough on the Pi. I've compared performance running Selfoss on the Pi to a free web hosting service and the performance was near identical.

Installation

Install the following:

sudo apt-get install lighttpd php5 php5-cgi php5-cli php5-sqlite php5-gd

Configure lighttpd

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

unzip (as root) selfoss into /var/www so the directory is /var/www/selfoss

sudo chown -R www-data:www-data /var/www/selfoss/

Edit "/etc/lighttpd/lighttpd.conf": in server.modules uncomment "mod_rewrite" also, check if server.document_root is set to "/var/www", if it's not, change that accordingly

Add the following:

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

Edit /etc/php5/cgi/php.ini: max_execution_time = 60

cd /var/www/selfoss/

Edit .htaccess uncomment "RewriteBase /selfoss"

Copy default.ini to config.ini Edit config.ini: auto_mark_as_read=1

Add the update to the root crontab: sudo crontab -e

Then add the following:

*/35 6-23 * * * su - www-data -c "/usr/bin/php /var/www/selfoss/cliupdate.php"

Restart lighttpd: sudo service lighttpd restart

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