Browser bookmarks has been an essential part of browsing for me. But once multiple browsers started appearing, I found that I couldn’t share my bookmarks across browsers.

And then delicio.us appeared. And they even had a free tier! That was such a lifesaver. But like all good things it came to an end and I had to choose something different. I exported all my bookmarks to Diigo and had been using it for ages.

But from the time I got more comfortable with the server side of things, I wanted get off Diigo as well. I didn’t want to face the same problem again in the future.

I came across Shaarli some years ago and always wanted to install it on my own server. Shaarli seemed to always get recommended as an easy-to-install software.

To install it, I had to use something called Composer which I had never heard of before. After some hours of hunting around I finally managed to do something like this –

Install Composer

Following commands performed as root

curl -s https://getcomposer.org/installer | php

Running this gave me an output like this

All settings correct for using Composer
Downloading...

Composer (version 1.7.3) successfully installed to: <current folder>/composer.phar
Use it: php composer.phar

I had to move composer to a directory so that it could be used globally, and then update it

mv composer.phar to /usr/bin
composer update

Install Shaarli

Following commands run as normal user

I followed the steps on the Shaarli github page to install.

git clone https://github.com/shaarli/Shaarli.git -b stable /path/to/shaarli/
cd /path/to/shaarli/
composer install --no-dev --prefer-dist

What was also needed was to make certain directories writable, so –

chmod -R 777 cache data pagecache tmp

And that was it.

Configuring Nginx

The nginx configuration ended up (after a few trials), like this –

server {

  listen			80;
  server_name		bookmarks.abhij.it;
  root 			/path/to/shaarli;

  autoindex off;
  client_max_body_size 4M;
  client_body_buffer_size 128k;
  index index.html index.htm index.php;
  access_log	/var/log/nginx/shaarli_access.log;
  error_log	/var/log/nginx/shaarli_error.log;

  # Pass PHP scripts to PHP-FPM
  location ~ \.php$ {
    try_files       $uri =404;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    fastcgi_index   index.php;
    include         fastcgi_params;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param   SERVER_NAME $host;
    fastcgi_param   PATH_INFO $uri;
    fastcgi_intercept_errors        on;
    fastcgi_ignore_client_abort     off;
    fastcgi_connect_timeout         60;
    fastcgi_send_timeout            180;
    fastcgi_read_timeout            180;
    fastcgi_buffer_size             128k;
    fastcgi_buffers         4       256k;
    fastcgi_busy_buffers_size       256k;
    fastcgi_temp_file_write_size    256k;
  }

  location ~ /(data|conf|bin|inc)/ {
    deny all;
  }

  location ~ /\.ht {
    deny	all;
  }

}