Skip to content

πŸ—‚οΈ Installing FileBrowser

filebrowser-banner

FileBrowser provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files. It allows the creation of multiple users and each user can have its own directory. It can be used as a standalone app.

filebrowser

Info

The project is open-source and can be downloaded here: https://github.com/filebrowser/filebrowser.


πŸ“₯ Installation

πŸ“‹ Requirements

Info

FileBrowser requires the installation of


🐳 Install FileBrowser

The use of Docker Compose will automate the installation of filebrowser container.

πŸ”§ Setup FileBrowser Parameters

Before deploying, you need to define a few environment variables that will be used throughout the setup process.

  • HOST_PORT: external port used by NGINX to route traffic to the service
  • ROOT_DIR: path to the root directory served by FileBrowser
# example of configuration for environment parameters
HOST_PORT=8000
ROOT_DIR=/path/to/root
βš™οΈ Configure FileBrowser for Docker Compose

Filebrowser can be deployed using Docker Compose. The compose.yml file will automatically incorporate the environment variables configured in the previous step. You can copy, paste, and run all of the following commands directly in your terminal.

# create docker directory
mkdir filebrowser && cd filebrowser
mkdir data config

# create default configuration for FileBrowser
touch data/database.db
wget https://raw.githubusercontent.com/filebrowser/filebrowser/master/docker/root/defaults/settings.json -O config/settings.json
# setup of compose.yml
tee compose.yml > /dev/null <<EOF
services:
  filebrowser:
    container_name: filebrowser
    user: \${HOST_UID}:\${HOST_GID}
    image: filebrowser/filebrowser:latest
    ports:
      - \${HOST_PORT}:80
    volumes:
      - \${ROOT_DIR}:/srv
      - ./data/database.db:/database.db
      - ./config/settings.json:/config/settings.json
    restart: unless-stopped
EOF
# setup of .env file
tee .env > /dev/null <<EOF
###################################################################################
# Run as non-root user
###################################################################################
HOST_UID=`id -u`
HOST_GID=`id -g`

###################################################################################
# NGINX Proxy Configuration
###################################################################################
HOST_PORT=${HOST_PORT}

###################################################################################
# FileBrowser Configuration
###################################################################################
ROOT_DIR=${ROOT_DIR}
EOF

Save the .env informations

All the secret informations are defined in the .env file.

🐳 Install FileBrowser with Docker Compose

Now that the compose.yml file has been generated, it's time to install all the containers.

# install and start the container
docker compose up -d

πŸš€ Deploy FileBrowser

Install NGINX

NGINX needs to be installed, follow the NGINX section.

Configure NGINX

NGINX needs to be configured using a file in /etc/nginx/sites-available directory.
This configuration file specify the documentation path:

server {
  server_name filebrowser.domain.fr;

  # setup 404 error_page
  error_page 404 /404.html;
  include snippets/error-404.conf;

  # reverse proxy
  location / {
    proxy_pass http://127.0.0.1:8000;

    # keep it HTTP/1.1 and enable WebSockets
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;

    # forwarded headers
    include proxy_params;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;

    # timeouts for long-running websocket/exec sessions
    proxy_read_timeout 3600;
    proxy_send_timeout 3600;

    # max allowed upload/request size (2 GB)
    client_max_body_size 2000M;

    # avoid buffering for interactive streams
    proxy_buffering off;
  }
}
# enable site for production
sudo ln -s /etc/nginx/sites-available/filebrowser.domain.fr /etc/nginx/sites-enabled/filebrowser.domain.fr

# restart nginx
sudo nginx -t && sudo service nginx restart

Replace filebrowser.domain.fr by the name of your website.
Replace alias /path/icons/ by the path of your custom icons.

Activate HTTPS

To activate HTTPS protocol, follow theΒ Let's Encrypt section.

Change Admin Password

The website should be operationnal and accessible through: https://files.domain.fr.

To authenticate on the server, use:

  • user: admin
  • password: admin

Change default password: Settings => Profile Settings => Change Password