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:
- A Klutch.sh account
- A GitHub account with a repository for your configuration
- Basic familiarity with Docker and file management
Preparing Your Repository
Create a GitHub repository with the following structure:
tiny-file-manager/├── Dockerfile├── .dockerignore└── config.phpCreating the Dockerfile
FROM php:8.1-apache
# Install required PHP extensionsRUN 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 modulesRUN a2enmod rewrite
# Set working directoryWORKDIR /var/www/html
# Download Tiny File ManagerRUN curl -fsSL https://raw.githubusercontent.com/prasathmani/tinyfilemanager/master/tinyfilemanager.php -o index.php
# Copy custom configurationCOPY config.php /var/www/html/config.php
# Create files directoryRUN mkdir -p /var/www/html/files \ && chown -R www-data:www-data /var/www/html
# Configure PHPRUN 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:
<?phpecho password_hash('your_password', PASSWORD_DEFAULT);?>Environment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
TFM_ROOT_PATH | No | ./files | Root directory for files |
TFM_TIMEZONE | No | UTC | Server timezone |
Deploying on Klutch.sh
Generate Password Hashes
Create secure password hashes for user accounts:
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 Path | Size | Purpose |
|---|---|---|
/var/www/html/files | 50 GB | File 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
Navigation
Navigate through your files:
- Click folders to enter them
- Use breadcrumbs to go back
- Use search to find specific files
File Operations
Available operations:
| Operation | Description |
|---|---|
| Upload | Drag-and-drop or click to upload |
| Download | Download files or folders as ZIP |
| Create | New files or folders |
| Rename | Change file/folder names |
| Copy | Copy files to clipboard |
| Move | Move files to new location |
| Delete | Remove files (with confirmation) |
| Edit | Edit text files in browser |
File Editing
Edit text files directly:
- Click on a text file
- Select “Edit” option
- Make changes in the code editor
- 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:
- Select files/folders
- Choose “Create archive”
- Specify archive name
- Download or store ZIP file
Extract archives:
- Click on ZIP file
- Select “Extract”
- 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 filesRole Differences
| Capability | Admin | User | Read-Only |
|---|---|---|---|
| View files | Yes | Yes | Yes |
| Upload | Yes | Yes | No |
| Delete | Yes | Yes | No |
| Edit | Yes | Yes | No |
| Settings | Yes | No | No |
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:
- Regular volume backups
- Off-site backup copies
- Version control for important documents
- 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_pathconfiguration - Verify volume mount path
- Check file permissions
- Review
$exclude_itemssettings
Performance Issues
- Reduce files per directory
- Increase PHP memory limit
- Check server resources
- Optimize large file handling
Additional Resources
- Tiny File Manager Website
- Tiny File Manager GitHub
- Tiny File Manager Wiki
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
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.