When I first build my NAS one of the first things I did was create an SMB share for photos and migrate all of the family photos from their various hard drives, SD cards and misc locations.

In had initially planned to organise and sort all of the photos, but very quickly the share became full of duplicates and misc folders with no organisation in sight. The other problem was accessibility. While a network share worked for me, it wasn’t really ideal for the less technically inclined in my family.

To this end I decided that I really needed a web frontend and after spending some time googling I stumbled across Lychee.

Lychee is a free photo-management tool, which runs on your server or web-space. Installing is a matter of seconds. Upload, manage and share photos like from a native application. Lychee comes with everything you need and all your photos are stored securely.

Lychee Screenshot

To host Lychee I created a new Ubuntu 16.04 LXC container in Proxmox and to start assigned it 1vCPU, 512MB of RAM and 50GB of disk space.

The Lychee installation instructions here only deal with the installation of Lychee itself, although all that is required for Lychee to run is PHP5 or later, a web server and MySQL.

I installed Nginx, MySQL and PHP7 with the required extensions:

sudo apt-get install mysql-{server,client} nginx php-{fpm,sql,imagick} php7.0-{gd,zip,mbstring} imagemagick git

In /etc/php/7.0/fpm/php.ini I set the following options:

max_execution_time = 200
post_max_size = 100M
upload_max_size = 100M
upload_max_filesize = 20M
memory_limit = 256M

I then ran mysql_secure_installation to secure my MySQL installation then created a new SQL service account and database for Lychee.

I then created a new Nginx site: sudo vim /etc/nginx/sites-available/lychee

server {
    listen 80;

    root /var/www/Lychee;
    index index.php index.html index.htm index.nginx-debian.html;

    server_name lychee.my.internal.domain;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_param PHP_VALUE "max_execution_time=1800
                                post_max_size=1500M
                                upload_max_filesize=32M
                                max_input_time=1800
                                max_file_uploads=300";
    }

    location ~ /\.ht {
        deny all;
    }
}

And enabled it: sudo ln -s /etc/nginx/sites-{available,enabled}/lychee

I then pulled the latest release of Lychee and set the required permissions: (I strongly dislike 777 permissions and have since adjusted these to more appropriate values).

cd /var/www/
sudo git clone https://github.com/electerious/Lychee.git
cd Lychee/
sudo chmod -R 777 uploads/ data/

I then restarted the required services:

sudo systemctl restart nginx.service
sudo systemctl restart php7.0-fpm.service

And checked for the presence of the required PHP extensions:

php --info | grep exif
php --info | grep mbstring
php --info | grep gd
php --info | grep mysqli
php --info | grep json
php --info | grep zip

After configuring DNS I was then able to navigate to the URL of my new Lychee installation to do the initial configuration and start uploading.

I have now been using Lychee for several months and it hasn’t had any problems.

The upgrade procedure is also very simple:

cd /var/www/Lychee
sudo git pull

All in all I’m very happy with Lychee. There are quite a few available plugins which I have yet to explore and dropbox sync is also a feature that I need to look into.

However, for the time being I’m busy uploading and sorting all my photos.