Skip to content

Deploying Tiny File Manager

Introduction

Tiny File Manager is a lightweight, single-file PHP application for managing files and folders through a web browser. Despite its small footprint, it offers a comprehensive set of features for file operations, making it an excellent choice for quick file management access to your server storage.

Key features of Tiny File Manager include:

  • Single File Application: Just one PHP file to deploy
  • File Operations: Create, delete, copy, move, rename files and folders
  • Upload Support: Drag-and-drop file uploads with progress
  • File Editing: Built-in code editor for text files
  • Preview: Image, video, and audio file previews
  • Archive Support: Create and extract ZIP archives
  • Multiple Users: Support for multiple user accounts
  • Role-Based Access: Admin and user permission levels
  • Search: Find files by name or content
  • Responsive Design: Works on desktop and mobile
  • No Database: Simple file-based configuration
  • Lightweight: Minimal server resource requirements

This guide walks you through deploying Tiny File Manager on Klutch.sh, configuring user access, and managing your files securely.

Why Deploy Tiny File Manager on Klutch.sh

Deploying Tiny File Manager on Klutch.sh provides several advantages:

Remote File Access: Manage files on your server from any browser.

Simplified Deployment: Klutch.sh handles container orchestration automatically.

HTTPS by Default: Secure file transfers with automatic SSL certificates.

Persistent Storage: Files persist reliably across deployments.

Lightweight: Minimal resource requirements for efficient operation.

Prerequisites

Before deploying Tiny File Manager on Klutch.sh, ensure you have:

Preparing Your Repository

Create a GitHub repository with the following structure:

tiny-file-manager/
├── Dockerfile
├── .dockerignore
└── config.php

Creating the Dockerfile

FROM php:8.1-apache
# Install required PHP extensions
RUN apt-get update && apt-get install -y \
libzip-dev \
zip \
unzip \
&& docker-php-ext-install zip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Enable Apache modules
RUN a2enmod rewrite
# Set working directory
WORKDIR /var/www/html
# Download Tiny File Manager
RUN curl -fsSL https://raw.githubusercontent.com/prasathmani/tinyfilemanager/master/tinyfilemanager.php -o index.php
# Copy custom configuration
COPY config.php /var/www/html/config.php
# Create files directory
RUN mkdir -p /var/www/html/files \
&& chown -R www-data:www-data /var/www/html
# Configure PHP
RUN echo "upload_max_filesize = 1024M" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "post_max_size = 1024M" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "memory_limit = 256M" >> /usr/local/etc/php/conf.d/uploads.ini \
&& echo "max_execution_time = 600" >> /usr/local/etc/php/conf.d/uploads.ini
EXPOSE 80
CMD ["apache2-foreground"]

Configuration File

Create config.php:

<?php
// Authentication
$auth_users = array(
'admin' => '$2y$10$hash_for_admin_password',
'user' => '$2y$10$hash_for_user_password'
);
// User roles (true = admin, false = normal user)
$readonly_users = array(
'user'
);
// Enable file viewer
$use_viewer = true;
// Default language
$lang = 'en';
// Root path (where files are stored)
$root_path = './files';
// Root URL for links
$root_url = '';
// Server timezone
$timezone = 'UTC';
// Allowed file extensions (empty = all)
$allowed_file_extensions = '';
// Allowed upload extensions (empty = all)
$allowed_upload_extensions = '';
// Show hidden files
$show_hidden = false;
// Favicon path
$favicon_path = '';
// Files excluded from listing
$exclude_items = array();
// Disable online editing
$online_viewer = 'google';
// Maximum upload size (bytes)
$max_upload_size_bytes = 1073741824; // 1GB
// Enable IP whitelist (empty = disabled)
$ip_whitelist = array();
// IP blacklist
$ip_blacklist = array();
// Show breadcrumb navigation
$show_breadcrumb = true;
// Date format for file listing
$date_format = 'Y-m-d H:i:s';

Generating Password Hashes

Generate password hashes for your configuration:

<?php
echo password_hash('your_password', PASSWORD_DEFAULT);
?>

Environment Variables Reference

VariableRequiredDefaultDescription
TFM_ROOT_PATHNo./filesRoot directory for files
TFM_TIMEZONENoUTCServer timezone

Deploying on Klutch.sh

    Generate Password Hashes

    Create secure password hashes for user accounts:

    Terminal window
    php -r "echo password_hash('adminpassword', PASSWORD_DEFAULT);"

    Update config.php with the generated hashes.

    Push Your Repository to GitHub

    Commit and push your Dockerfile and configuration.

    Create a New Project on Klutch.sh

    Navigate to the Klutch.sh dashboard and create a new project named “file-manager”.

    Create the Tiny File Manager App

    Within your project, create a new app and connect your GitHub repository.

    Configure HTTP Traffic

    Set the traffic type to HTTP with the internal port set to 80.

    Attach Persistent Volumes

    Add persistent storage for your files:

    Mount PathSizePurpose
    /var/www/html/files50 GBFile storage (adjust as needed)

    Deploy Your Application

    Click Deploy to build and launch Tiny File Manager.

    Access File Manager

    Visit https://your-app-name.klutch.sh and log in with your credentials.

Using Tiny File Manager

Navigate through your files:

  • Click folders to enter them
  • Use breadcrumbs to go back
  • Use search to find specific files

File Operations

Available operations:

OperationDescription
UploadDrag-and-drop or click to upload
DownloadDownload files or folders as ZIP
CreateNew files or folders
RenameChange file/folder names
CopyCopy files to clipboard
MoveMove files to new location
DeleteRemove files (with confirmation)
EditEdit text files in browser

File Editing

Edit text files directly:

  1. Click on a text file
  2. Select “Edit” option
  3. Make changes in the code editor
  4. Save changes

Supported file types:

  • Plain text (.txt)
  • Configuration files (.conf, .ini)
  • Code files (.php, .js, .css, .html, .py)
  • Data files (.json, .xml, .yaml)

Archive Operations

Create and extract archives:

  1. Select files/folders
  2. Choose “Create archive”
  3. Specify archive name
  4. Download or store ZIP file

Extract archives:

  1. Click on ZIP file
  2. Select “Extract”
  3. Choose destination

File Preview

Preview supported file types:

  • Images: JPG, PNG, GIF, SVG
  • Videos: MP4, WebM
  • Audio: MP3, OGG
  • Documents: PDF (via browser)

User Management

Adding Users

Add users in config.php:

$auth_users = array(
'admin' => '$2y$10$hash...',
'newuser' => '$2y$10$hash...'
);

Setting Permissions

Configure user permissions:

// Read-only users (no upload/delete)
$readonly_users = array(
'readonly_user'
);
// Admins have full access
// Normal users can upload but not access system files

Role Differences

CapabilityAdminUserRead-Only
View filesYesYesYes
UploadYesYesNo
DeleteYesYesNo
EditYesYesNo
SettingsYesNoNo

Security Configuration

IP Whitelisting

Restrict access by IP:

$ip_whitelist = array(
'192.168.1.0/24',
'10.0.0.5'
);

File Extension Restrictions

Limit allowed file types:

// Only allow specific extensions
$allowed_upload_extensions = 'jpg,jpeg,png,gif,pdf,doc,docx';
// Block specific extensions
$exclude_extensions = 'php,exe,sh,bat';

Hidden Files

Control hidden file visibility:

$show_hidden = false; // Hide files starting with .

Production Best Practices

Security Recommendations

  • Strong Passwords: Use complex passwords for all accounts
  • HTTPS Only: Always access via HTTPS (automatic with Klutch.sh)
  • Limit Users: Only create necessary accounts
  • IP Restrictions: Use whitelisting for sensitive environments
  • Extension Filtering: Restrict dangerous file types

Performance Tips

  • Upload Limits: Set appropriate max upload sizes
  • Cleanup: Regularly remove unnecessary files
  • Monitoring: Watch storage usage
  • Caching: Browser caches improve performance

Backup Strategy

Protect your files:

  1. Regular volume backups
  2. Off-site backup copies
  3. Version control for important documents
  4. Test restore procedures

Troubleshooting

Cannot Upload Files

  • Check PHP upload limits in configuration
  • Verify file extension is allowed
  • Ensure adequate disk space
  • Check file permissions

Login Not Working

  • Verify password hash format
  • Check username spelling
  • Clear browser cache
  • Review config.php syntax

Files Not Visible

  • Check $root_path configuration
  • Verify volume mount path
  • Check file permissions
  • Review $exclude_items settings

Performance Issues

  • Reduce files per directory
  • Increase PHP memory limit
  • Check server resources
  • Optimize large file handling

Additional Resources

Conclusion

Deploying Tiny File Manager on Klutch.sh provides a lightweight, efficient solution for web-based file management. With its single-file architecture, comprehensive features, and minimal resource requirements, Tiny File Manager offers convenient access to your server files from any browser. The combination of Tiny File Manager’s simplicity and Klutch.sh’s reliable infrastructure ensures secure, accessible file management for your projects.