This is an old revision of the document!
FileBrowser
File Browser is a nice web-based file manager for your server.
I do not like the default installation method because it will install system-wide. I will show you how to install in a more customized way.
first you need to create a new user:
> useradd -d /data/daemons/filebrowser -m filebrowser -g users
the filebrowser user will have users as it's main group so that any files managed by it can be accessed and managed by users as well.
You need to set the umask for the user to 0002 so that any new files created by it will be writable by the users.
Then, as filebrowser user, get the software package and decompress it. 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 > echo "umask 0002" >> ~/.bashrc > tar xvf linux-amd64-filebrowser.tar.gz > ./filebrowser config set --auth.method noauth
since it will be hidden behind the reverse proxy, you can disable FileBrowser internal authentication.
You need to setup filebrowser to access your common archive, so create the folder /data/archive/common and own it to filebrowser:users:
> mkdir /data/archive > mkdir /data/archive/common > chown -R filebrowser:users /data/archive/common
Now, a startup script:
- filebrowser.sh
#!/bin/bash cd /data/daemons/filebrowser && ./filebrowser -r /depoisito/archive/common -p 3002 -b /archive/common/ 2>&1 > filebrowser.log
And the usual autostart stuff:
- 40-filebrowser.start
#!/bin/bash start-stop-daemon -b -m -p /var/run/filebrowser.pid -n filebrowser -u filebrowser /data/daemons/filebrowser/filebrowser.sh
Make both files executable.
Now, reverse proxy is simple, but this into /etc/nginx/folders/filebrowser.conf:
- filebrowser.conf
location /archive/common/ { 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; }
and put this file include inside the usual /etc/nginx*/folders/main.conf, and restart nginx.
- filebrowser.sh
#!/bin/bash SHARES="common:3002:filebrowser" BASE_PATH=/deposito/daemons/filebrowser/data for i in $SHARES do SHARE=$(echo $i | cut -d: -f1) PORT=$(echo $i | cut -d: -f2) OWNER=$(echo $i | cut -d: -f3) echo Starting FileBrowser for $OWNER on share $SHARE su - $OWNER -c "/deposito/daemons/filebrowser/bin/filebrowser config set --auth.method=noauth -d $BASE_PATH/db/filebrowser_$SHARE.db >/dev/null" su - $OWNER -c "/deposito/daemons/filebrowser/bin/filebrowser -r /deposito/$SHARE -p $PORT -b /archive/$SHARE -d $BASE_PATH/db/filebrowser_$SHARE.db -l $BASE_PATH/logs/filebrowser_$ SHARE.log 2> $BASE_PATH/logs/filebrowser_${SHARE}_run.log"& echo Starting WebDAV backend for $OWNER on share $SHARE done