FileRun is a robust, self-hosted file management and sharing platform, often considered a lightweight alternative to Google Drive or Nextcloud. It provides full control over your data while offering advanced features like rich metadata handling, preview support for various media formats, and seamless integrations with third-party tools. In this guide, weβll walk you through deploying FileRun, securing it with Nginx, enabling logs for debugging, setting up backups, updating the app, and unlocking its unique features.
Installing FileRun
π¦ Docker/Docker Compose Setup
Using Docker Compose is the simplest way to deploy FileRun. Below is a docker-compose.yml
file tailored to FileRun's requirements:
version: '3.3'
services:
db:
image: mariadb:10.5
container_name: filerun_db
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_USER: filerun
MYSQL_PASSWORD: filerun_password
MYSQL_DATABASE: filerun
volumes:
- ./db_data:/var/lib/mysql
web:
image: filerun/filerun
container_name: filerun_app
restart: unless-stopped
ports:
- "8080:80"
environment:
FR_DB_HOST: db
FR_DB_PORT: 3306
FR_DB_NAME: filerun
MYSQL_USER: filerun
MYSQL_PASSWORD: filerun_password
volumes:
- ./filerun_data:/user-files
- ./filerun_config:/var/www/html
depends_on:
- db
To deploy FileRun:
mkdir filerun && cd filerun
nano docker-compose.yml # Paste the above YAML
docker-compose up -d
This starts two containers: one for the MariaDB database and another for the FileRun application. Access FileRun at http://<server-ip>:8080
.
π Manual Installation
For those who prefer manual setup on a Linux server:
- Install Dependencies:
sudo apt update && sudo apt install -y apache2 php libapache2-mod-php mariadb-server unzip php-mysql
- Configure MariaDB:
sudo mysql
CREATE DATABASE filerun;
CREATE USER 'filerun'@'localhost' IDENTIFIED BY 'filerun_password';
GRANT ALL PRIVILEGES ON filerun.* TO 'filerun'@'localhost';
FLUSH PRIVILEGES;
EXIT;
- Download and Extract FileRun:
wget -O filerun.zip https://filerun.com/download-latest
sudo unzip filerun.zip -d /var/www/html/
sudo chown -R www-data:www-data /var/www/html/filerun
- Enable Apache and Restart:
sudo a2enmod rewrite
sudo systemctl restart apache2
Access FileRun at http://<server-ip>/filerun
to complete the installation.
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
Using Nginx to route traffic to FileRun ensures better performance and flexibility. Below is a server block for your Nginx configuration:
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Save this file as /etc/nginx/sites-available/filerun
and enable the configuration:
sudo ln -s /etc/nginx/sites-available/filerun /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
π SSL/TLS Setup
Secure the connection using Letβs Encrypt:
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d example.com
Let Certbot handle SSL renewals automatically.
π οΈ Testing and Reloading Nginx
Verify your Nginx configuration with:
sudo nginx -t
sudo systemctl reload nginx
Visit https://example.com
to test your secure FileRun setup.
Logging and Debugging FileRun
ποΈ Enabling Debug Logs
To enable debug-level logs, modify config.php
in FileRun:
define('DEBUG', true);
π Viewing Logs
For Docker users:
docker logs filerun_app
For manual installations, check the logs at /var/www/html/filerun/logs/
.
π οΈ Troubleshooting Common Issues
If you encounter a blank page, check PHP's error log:
sudo tail -f /var/log/apache2/error.log
π€ Exporting Logs
Send logs to an external ELK stack by mounting a shared volume to /var/www/html/filerun/logs/
in your Docker configuration.
Backup and Restore
ποΈ File-Based Backups
Backup FileRunβs data directory:
tar -czvf filerun_backup.tar.gz /user-files
π Database Backups
For Docker MariaDB:
docker exec filerun_db mysqldump -u filerun -pfilerun_password filerun > filerun_db_backup.sql
For manual MariaDB:
mysqldump -u filerun -pfilerun_password filerun > filerun_db_backup.sql
π Automated Backup Scripts
Create a cron job to automate backups:
crontab -e
0 2 * * * /usr/bin/docker exec filerun_db mysqldump -u filerun -pfilerun_password filerun > /path/to/backups/filerun_db_backup.sql
Updating and Upgrading FileRun
β¬οΈ Updating Docker Images
Update FileRunβs Docker container with:
docker-compose pull
docker-compose up -d
π οΈ Manual Updates
For manual installations, download the latest version and replace the existing files:
wget -O filerun.zip https://filerun.com/download-latest
sudo unzip -o filerun.zip -d /var/www/html/
sudo chown -R www-data:www-data /var/www/html/filerun
π Checking for Updates
FileRunβs admin panel often notifies you of available updates. Alternatively, monitor their GitHub repo.
Leveraging FileRunβs Unique Features
π§ Enabling APIs
Activate FileRunβs API from the admin panel under Control Panel > API
. Test the API with:
curl -X POST -H "Authorization: Bearer <token>" -d "param=value" https://example.com/api/path
π Advanced Configurations
Enable external storage (e.g., Google Drive or S3) by navigating to Control Panel > External Storage
and configuring credentials.
Wrapping Up
Self-hosting FileRun provides unparalleled control over your data while offering advanced file management features. Following this guide, you can deploy, secure, and manage FileRun effectively. Start exploring its powerful APIs, external storage options, and customization capabilities today!