DEV Community

Cover image for FileBrowser (Service) Configuring to work with Apache2 as a reverse proxy on Ubuntu 24.04
Rajib Ahmed
Rajib Ahmed

Posted on

FileBrowser (Service) Configuring to work with Apache2 as a reverse proxy on Ubuntu 24.04

FileBrowser service by configuring it to work with Apache2 as a reverse proxy on Ubuntu 24.04. Here’s how you can set it up:

Step 1: Install Apache2
First, ensure that Apache2 is installed and running on your system:

bash
sudo apt update
sudo apt install apache2
sudo systemctl start apache2
sudo systemctl enable apache2

Step 2: Install and Configure FileBrowser
Download and set up FileBrowser:

Download FileBrowser:

bash
curl -fsSL https://filebrowser.org/cli.sh | bash

Run FileBrowser:
bash
filebrowser -r /path/to/your/files

Access FileBrowser: You should now be able to access FileBrowser locally at http://127.0.0.1:8080.

Step 3: Configure Apache2 as a Reverse Proxy
To make FileBrowser accessible through Apache2, configure Apache2 as a reverse proxy:

Enable the necessary Apache2 modules:

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo systemctl restart apache2
Enter fullscreen mode Exit fullscreen mode

Create a new virtual host file for FileBrowser:

bash
sudo nano /etc/apache2/sites-available/filebrowser.conf

Add the following configuration:

`apache

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

ProxyPreserveHost On
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/

ErrorLog ${APACHE_LOG_DIR}/filebrowser_error.log
CustomLog ${APACHE_LOG_DIR}/filebrowser_access.log combined
Enter fullscreen mode Exit fullscreen mode

`
Enable the new virtual host:

bash
sudo a2ensite filebrowser.conf
sudo systemctl reload apache2

Step 4: Access FileBrowser via Apache2
You should now be able to access FileBrowser via your domain or IP through Apache2.

If you want to run FileBrowser as a system service, you can create a service file:

Create a service file:
bash
sudo nano /etc/systemd/system/filebrowser.service

Add the following content:

`ini
[Unit]
Description=File Browser
After=network.target

[Service]
User=www-data
ExecStart=/usr/local/bin/filebrowser -r /path/to/your/files
Restart=on-failure

[Install]
WantedBy=multi-user.target`

Enable and start the service:
bash
sudo systemctl enable filebrowser
sudo systemctl start filebrowser

This setup will ensure that FileBrowser is running and accessible through Apache2 on your Ubuntu 24.04 system.

Top comments (0)