FileBrowser

There are a few software out there, but i like File Browser a lot because it's lightweight, don't get in the way, is flexible and simple to use, but i do not like the default installation method of FileBrowser because it will install system-wide. I will show you how to install in a more customized way.

Installation

Create a standard user to host the FileBrowser installation. You will most probably never run it as this user, but always as different users, to allow it manage files owned by those users.

useradd -d /data/daemons/filebrowser -m filebrowser

The default install approach is based on a auto executable web link (here) which i do not recommend to use directly. Instead go to here and download the proper package for your architecture. Then:

su - filebrowser
mkdir bin
cd bin
tar xvf ../linux-amd64-filebrowser.tar.gz

That's it!

Reverse Proxy

Running FileBrowser behind NGINX is easy, this is an example:

filebrowser.conf
  location /filebrowser/ {
        client_max_body_size 512M;

        proxy_pass http://127.0.0.1:3002;
        proxy_http_version 1.1;

        proxy_set_header Connection $http_connection;
        proxy_set_header Connection 'upgrade';
        proxy_cache_bypass $http_upgrade;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        #proxy_set_header Authorization $remote_user;

    }

Remember to set the correct port as each instance of FileBrowser will have to run with it's own port, and set a reasonable location URL. This setup will also make use of FileBrowser user intergation with Proxy Authentication, if used, by uncommenting the last line.

Running

I assume you want to run it as user myuser.

As a general startup rule, the first time you need to run it once to create the needed configuration files and database, then you want to start it with a script and have it start automatically at boot.

For initial configuration:

su - myuser
/data/daemons/filebrowser/bin/filebrowser -r "/data/MyFiles" -p 3005 -d "/home/myuser/filebrowser.db"

The start script should be something like:

filebrowser.sh
#!/bin/bash
FILEBROWSER="/data/daemons/filebrowser/bin/filebrowser"
APP_PATH="/home/myuser"
DATA_PATH="/data/MyFiles"
BASE_URL="/files/myuser"
PORT=3005
"${FILEBROWSER}" config set --auth.method=noauth -d "${APP_PATH}/filebrowser.db" 2>&1 >> "${APP_PATH}/filebrowser.log"
"${FILEBROWSER}" -r "${DATA_PATH}" -p ${PORT} -b "${BASE_URL}" -d "${APP_PATH}/filebrowser.db" -l "${APP_PATH}/filebrowser.log" 2>&1 >> "${APP_PATH}/filebrowser.log"

And the startup script should be /etc/local.d/40-filebrowser.start:

40-filebrowser.start
#!/bin/bash
start-stop-daemon -b -m -p /var/run/myuser/filebrowser-myuser.pid -n myuser-filebrowser -u myuser /home/myuser/filebrowser.sh

make both executable of course.