Skip to content

Deploying FileGator

Introduction

FileGator is a free, open-source, lightweight PHP file manager that provides a powerful yet simple solution for managing files through a clean web interface. Built with modern web technologies, FileGator offers a fast, responsive experience for uploading, downloading, organizing, and sharing files without the complexity of heavier file management systems.

FileGator excels at providing essential file management capabilities:

  • Lightweight & Fast: Built on PHP with minimal dependencies for quick loading and efficient performance
  • Modern Interface: Clean, intuitive UI with drag-and-drop functionality
  • Multi-User Support: Create multiple users with customizable permissions and roles
  • File Operations: Upload, download, rename, move, copy, and delete files with ease
  • Archive Support: Create and extract ZIP archives directly in the browser
  • Search Functionality: Quickly find files and folders with built-in search
  • File Sharing: Generate shareable links for files and folders
  • Markdown Viewer: Built-in viewer for markdown files
  • Image Preview: Thumbnail generation and image gallery view
  • Code Editor: Edit text and code files directly in the browser
  • Responsive Design: Works seamlessly across desktop, tablet, and mobile devices
  • Self-Hosted: Complete control over your files and data privacy

Whether you need a simple file manager for personal use, a team collaboration tool, or a lightweight alternative to heavyweight file management systems, FileGator provides the perfect balance of features and simplicity.

This comprehensive guide walks you through deploying FileGator on Klutch.sh using Docker, including detailed installation steps, persistent storage configuration, user management, and production-ready best practices.


What You’ll Learn

  • How to deploy FileGator with a Dockerfile on Klutch.sh
  • Setting up persistent storage for files and configuration
  • Configuring user authentication and permissions
  • Implementing environment variables for customization
  • Best practices for security, performance, and file management

Prerequisites

Before you begin, ensure you have:

  • A Klutch.sh account
  • A GitHub account with a repository for your FileGator project
  • Basic familiarity with Docker and file management concepts
  • (Optional) Docker installed locally for testing

Understanding FileGator Architecture

FileGator consists of several key components:

  • PHP Backend: Lightweight PHP application handling file operations
  • Web Interface: Modern JavaScript-based UI for file management
  • Storage Layer: File system storage for user files and application data
  • User Management: Built-in authentication and role-based permissions
  • Configuration: JSON-based configuration for customization

The application runs on port 80 by default (Apache/PHP), making it straightforward to deploy on Klutch.sh with automatic HTTPS.


Step 1: Prepare Your GitHub Repository

    1. Create a new GitHub repository for your FileGator deployment.

    2. Create a Dockerfile in the root of your repository with the following content:

    FROM filegator/filegator:latest
    # Expose the default HTTP port
    EXPOSE 80
    # The application stores files in /var/www/filegator/repository
    # and configuration in /var/www/filegator/private
    VOLUME ["/var/www/filegator/repository", "/var/www/filegator/private"]
    # Apache is configured to run FileGator
    # No additional CMD needed - uses base image entrypoint

    Note: This Dockerfile uses the official FileGator image which includes PHP, Apache, and all dependencies pre-configured.

    1. (Optional) Create an advanced Dockerfile with custom configuration:
    FROM filegator/filegator:latest
    # Install additional PHP extensions if needed
    RUN apt-get update && apt-get install -y \
    php-imagick \
    php-redis \
    && rm -rf /var/lib/apt/lists/*
    # Create necessary directories
    RUN mkdir -p /var/www/filegator/repository /var/www/filegator/private
    # Set proper permissions
    RUN chown -R www-data:www-data /var/www/filegator/repository /var/www/filegator/private
    # Expose HTTP port
    EXPOSE 80
    # Health check
    HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
    CMD curl -f http://localhost/ || exit 1
    # Use default entrypoint from base image
    1. (Optional) Create a .dockerignore file:
    .git
    .github
    *.md
    README.md
    .env
    .env.local
    docker-compose.yml
    node_modules
    1. Create a README.md file with setup information:
    # FileGator Deployment on Klutch.sh
    This repository contains the Docker configuration for deploying FileGator on Klutch.sh.
    ## About FileGator
    FileGator is a lightweight, free, and open-source PHP file manager.
    ## Features
    - Multi-user support with role-based permissions
    - Drag-and-drop file uploads
    - ZIP archive creation and extraction
    - Built-in code editor and markdown viewer
    - File sharing with generated links
    - Search functionality
    - Responsive mobile-friendly interface
    ## Initial Setup
    1. Deploy on Klutch.sh
    2. Attach persistent volumes for files and configuration
    3. Access the web interface
    4. Complete initial setup and create admin user
    5. Configure users and permissions
    ## Default Credentials
    On first deployment, FileGator creates a default admin user:
    - Username: `admin`
    - Password: `admin123`
    **Important**: Change this password immediately after first login!
    ## Documentation
    - FileGator: https://docs.filegator.io
    - Klutch.sh: https://docs.klutch.sh
    1. Commit and push your changes to GitHub:
    Terminal window
    git add Dockerfile .dockerignore README.md
    git commit -m "Add FileGator Dockerfile for Klutch.sh deployment"
    git push origin main

Step 2: Create Your App on Klutch.sh

    1. Log in to Klutch.sh and navigate to the dashboard.

    2. Create a new project (if you don’t have one already) by clicking “New Project” and providing a project name like “File Management”.

    3. Create a new app within your project by clicking “New App”.

    4. Connect your GitHub repository by selecting it from the list of available repositories.

    5. Configure the build settings:

      • Klutch.sh will automatically detect the Dockerfile in your repository root
      • The build will use this Dockerfile automatically
    6. Set the internal port to 80 (FileGator’s default HTTP port). This is the port that traffic will be routed to within the container.

    7. Select HTTP traffic for the app’s traffic type.


Step 3: Configure Persistent Storage

FileGator requires persistent storage to retain user files and configuration across deployments.

    1. In your app settings, navigate to the “Volumes” section.

    2. Add the first persistent volume for file storage:

      • Mount Path: /var/www/filegator/repository
      • Size: Choose based on your file storage needs (start with 10 GB, scale as needed)
    3. Add a second persistent volume for configuration and private data:

      • Mount Path: /var/www/filegator/private
      • Size: 1 GB is typically sufficient for configuration and user data
    4. Save the volume configuration. This ensures all your files, user data, and settings persist even when the container is restarted or redeployed.

The persistent volumes store:

  • /var/www/filegator/repository: All user-uploaded files and folders
  • /var/www/filegator/private: Configuration files, user database, sessions, and logs

For more details on managing persistent storage, see the Volumes Guide.


Step 4: Configure Environment Variables

FileGator can be customized using environment variables. Configure these in the Klutch.sh dashboard:

    1. In your app settings, navigate to the “Environment Variables” section.

    2. Add basic configuration variables:

    Terminal window
    # Application settings
    APP_ENV=production
    APP_DEBUG=false
    # Public URL (set to your actual app URL)
    APP_URL=https://example-app.klutch.sh
    # Timezone configuration
    TZ=America/New_York
    # PHP Configuration
    PHP_MEMORY_LIMIT=256M
    PHP_UPLOAD_MAX_FILESIZE=100M
    PHP_POST_MAX_SIZE=100M
    PHP_MAX_EXECUTION_TIME=300
    1. Optional security and feature variables:
    Terminal window
    # Session configuration
    SESSION_LIFETIME=120
    # File upload restrictions
    ALLOWED_FILE_EXTENSIONS=jpg,jpeg,png,gif,pdf,doc,docx,xls,xlsx,zip,txt
    # Maximum file size (in bytes)
    MAX_FILE_SIZE=104857600
    # Enable/disable guest access
    GUEST_ACCESS=false
    # Enable/disable user registration
    USER_REGISTRATION=false
    1. Mark sensitive values as secrets in the Klutch.sh UI to prevent them from appearing in logs.

Important Security Notes:

  • Never commit secrets or passwords to your repository
  • Always use Klutch.sh environment variables for configuration
  • Change default admin credentials immediately after first login
  • Disable guest access unless specifically needed

Step 5: Deploy Your Application

    1. Review your configuration to ensure all settings are correct:

      • Dockerfile is detected
      • Internal port is set to 80
      • Persistent volumes are mounted to /var/www/filegator/repository and /var/www/filegator/private
      • Environment variables are configured
      • Traffic type is set to HTTP
    2. Click “Deploy” to start the build and deployment process.

    3. Monitor the build logs to ensure the deployment completes successfully. The build typically takes 2-4 minutes.

    4. Wait for the deployment to complete. Once done, you’ll see your app URL (e.g., https://example-app.klutch.sh).


Step 6: Initial Setup and Configuration

    1. Access your FileGator instance by navigating to your app URL (e.g., https://example-app.klutch.sh).

    2. Log in with default credentials:

      • Username: admin
      • Password: admin123
    3. Change the admin password immediately:

      • Click on the user icon in the top right
      • Select “Change Password”
      • Enter a strong, unique password
      • Save the changes
    4. Configure application settings:

      • Navigate to the settings menu (gear icon)
      • Review and update general settings
      • Configure upload limits
      • Set allowed file types
      • Enable or disable features
    5. Create additional users:

      • Go to the Users section
      • Click “Add User”
      • Set username, password, and permissions
      • Assign appropriate home directory
    6. Test file operations:

      • Upload a test file
      • Create folders
      • Test download and preview features
      • Verify permissions work correctly

Getting Started: Sample Usage

Here are common tasks you can perform with FileGator:

Basic File Operations

Upload Files:

  • Drag and drop files directly into the browser
  • Click the upload button to select files
  • Upload progress shows in real-time
  • Supports multiple file uploads

Create Folders:

1. Click the "New Folder" button
2. Enter folder name
3. Press Enter or click Create

Download Files:

  • Right-click on a file and select “Download”
  • Or select multiple files and use the download button
  • Files are downloaded directly to your browser

Working with Archives

Create ZIP Archive:

1. Select files and folders
2. Right-click and choose "Compress"
3. Enter archive name
4. Click Create
5. ZIP file is created in current directory

Extract ZIP Archive:

1. Right-click on a ZIP file
2. Select "Extract"
3. Choose extraction location
4. Files are extracted to specified folder

File Sharing

Generate Share Link:

1. Right-click on a file or folder
2. Select "Get Link"
3. Configure link settings:
- Expiration date
- Password protection
- Download limit
4. Copy the generated link
5. Share with others

Search and Navigation

Quick Search:

  • Use the search bar at the top
  • Search by filename
  • Results update in real-time
  • Click result to navigate to file

Editing Files

Text File Editing:

1. Double-click a text file
2. Built-in editor opens
3. Make changes
4. Click Save
5. File is updated on server

Supported file types for editing:

  • Text files (.txt)
  • Markdown files (.md)
  • Code files (.js, .php, .html, .css, etc.)
  • Configuration files (.json, .yml, .xml)

User Management

Creating Users

    1. Access User Management:

      • Log in as admin
      • Navigate to Settings > Users
    2. Add New User:

      • Click “Add User” button
      • Enter user details:
        • Username (required)
        • Password (required)
        • Email (optional)
        • Home directory path
    3. Set Permissions:

      • Choose user role (admin or user)
      • Set file operation permissions:
        • Read: View and download files
        • Write: Upload and modify files
        • Delete: Remove files and folders
        • Create: Create new files and folders
    4. Configure Restrictions:

      • Set upload size limits
      • Restrict file types
      • Set disk quota
      • Define allowed directories

Role-Based Permissions

FileGator supports flexible permission systems:

Admin Role:

  • Full access to all files and folders
  • User management capabilities
  • System configuration access
  • View all user activities
  • Manage shared links

User Role:

  • Access to assigned home directory
  • File operations based on permissions
  • Create and manage own shared links
  • Limited to assigned storage quota

Guest Access:

  • Read-only access to public folders
  • No upload or modification rights
  • Can download allowed file types
  • Time-limited sessions

Advanced Configuration

Custom Branding

Customize FileGator’s appearance:

    1. Update Logo:

      • Replace logo files in the public assets directory
      • Upload custom logo through settings
    2. Custom CSS:

      • Add custom CSS in the theme settings
      • Override default styles
      • Match your brand colors
    3. Custom Title:

      • Set in configuration file
      • Update browser title
      • Add custom footer text

File Type Restrictions

Configure allowed file types in environment variables:

Terminal window
# Allow only specific file types
ALLOWED_FILE_EXTENSIONS=jpg,jpeg,png,gif,pdf,doc,docx,xls,xlsx,txt,zip
# Or block specific types
BLOCKED_FILE_EXTENSIONS=exe,bat,sh,php,js

Upload Size Limits

Configure maximum upload sizes:

Terminal window
# PHP settings for file uploads
PHP_UPLOAD_MAX_FILESIZE=500M
PHP_POST_MAX_SIZE=500M
PHP_MEMORY_LIMIT=512M
PHP_MAX_EXECUTION_TIME=600

Storage Quotas

Set per-user storage limits:

  1. Edit user profile in admin panel
  2. Set disk quota in MB or GB
  3. Users see remaining quota in interface
  4. Upload blocked when quota exceeded

Integration Examples

Embedding FileGator

Embed FileGator in your website using an iframe:

<!DOCTYPE html>
<html>
<head>
<title>File Manager</title>
<style>
#filegator-frame {
width: 100%;
height: 800px;
border: none;
}
</style>
</head>
<body>
<h1>File Manager</h1>
<iframe
id="filegator-frame"
src="https://example-app.klutch.sh"
allow="clipboard-write">
</iframe>
</body>
</html>

API Access

FileGator provides API endpoints for programmatic access:

Terminal window
# List files in directory
curl -X GET "https://example-app.klutch.sh/api/files?path=/folder" \
-H "Authorization: Bearer YOUR_API_TOKEN"
# Upload file
curl -X POST "https://example-app.klutch.sh/api/upload" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "file=@/path/to/file.pdf" \
-F "path=/destination/folder"
# Download file
curl -X GET "https://example-app.klutch.sh/api/download?path=/file.pdf" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-o downloaded-file.pdf

JavaScript Integration

// FileGator API client example
class FileGatorClient {
constructor(baseUrl, apiToken) {
this.baseUrl = baseUrl;
this.apiToken = apiToken;
}
async listFiles(path = '/') {
const response = await fetch(`${this.baseUrl}/api/files?path=${path}`, {
headers: {
'Authorization': `Bearer ${this.apiToken}`
}
});
return response.json();
}
async uploadFile(file, destinationPath) {
const formData = new FormData();
formData.append('file', file);
formData.append('path', destinationPath);
const response = await fetch(`${this.baseUrl}/api/upload`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${this.apiToken}`
},
body: formData
});
return response.json();
}
async deleteFile(path) {
const response = await fetch(`${this.baseUrl}/api/delete`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${this.apiToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ path })
});
return response.json();
}
}
// Usage
const client = new FileGatorClient('https://example-app.klutch.sh', 'your-api-token');
// List files
client.listFiles('/documents')
.then(files => console.log('Files:', files))
.catch(error => console.error('Error:', error));
// Upload file
const fileInput = document.querySelector('#file-input');
fileInput.addEventListener('change', async (e) => {
const file = e.target.files[0];
const result = await client.uploadFile(file, '/uploads');
console.log('Upload result:', result);
});

Production Best Practices

Security

  • Change Default Credentials: Immediately change the default admin password
  • Strong Passwords: Enforce strong password policies for all users
  • HTTPS Only: Always use HTTPS (automatic on Klutch.sh)
  • Regular Updates: Keep FileGator updated to the latest version
  • File Type Restrictions: Limit allowed file types to reduce security risks
  • Disable Unnecessary Features: Disable guest access if not needed
  • Session Security: Configure appropriate session timeouts
  • Backup Regularly: Implement automated backup procedures

Performance

  • Resource Allocation: Allocate sufficient CPU and memory based on user count

    • Small deployments (< 10 users): 512MB RAM, 1 CPU
    • Medium deployments (10-50 users): 1GB RAM, 2 CPUs
    • Large deployments (50+ users): 2GB+ RAM, 4+ CPUs
  • PHP Optimization: Configure PHP settings for performance

    Terminal window
    PHP_MEMORY_LIMIT=512M
    PHP_OPCACHE_ENABLE=1
    PHP_REALPATH_CACHE_SIZE=4096K
  • Storage Performance: Use SSD-backed volumes for better I/O performance

  • Caching: Enable opcode caching for faster PHP execution

Data Management

  • Regular Backups: Create daily backups of both volumes

    • /var/www/filegator/repository (files)
    • /var/www/filegator/private (configuration)
  • Backup Strategy:

    • Daily automated backups
    • Weekly full backups
    • Monthly long-term retention
    • Off-site backup storage
  • Storage Monitoring: Monitor disk usage and set alerts

    • Check volume capacity regularly
    • Plan for growth
    • Implement data retention policies
  • File Cleanup: Implement policies for old file removal

    • Archive old files
    • Delete temporary files
    • Clean up user trash folders

Monitoring

Monitor these key metrics:

  • Application Health: Response times, error rates
  • Resource Usage: CPU, memory, disk I/O
  • Storage Capacity: Available disk space
  • User Activity: Active users, upload/download volumes
  • Error Logs: Monitor for application errors

Troubleshooting

Application Won’t Start

Issue: Container starts but application doesn’t respond

Solutions:

  • Verify internal port is set to 80
  • Check application logs in Klutch.sh dashboard
  • Ensure persistent volumes are properly mounted
  • Verify sufficient disk space in volumes
  • Check for PHP errors in logs

Cannot Upload Files

Issue: File uploads fail or timeout

Solutions:

  • Check PHP_UPLOAD_MAX_FILESIZE setting
  • Verify PHP_POST_MAX_SIZE is larger than upload size
  • Ensure volume has sufficient free space
  • Check user has write permissions
  • Review upload directory permissions
  • Verify PHP_MAX_EXECUTION_TIME for large files

Permission Denied Errors

Issue: Cannot read, write, or delete files

Solutions:

  • Verify user has appropriate permissions
  • Check file system permissions in volumes
  • Ensure www-data user owns files
  • Review user role assignments
  • Check directory permissions

Slow Performance

Issue: Application is slow or unresponsive

Solutions:

  • Increase instance CPU and memory
  • Optimize PHP settings (increase memory limit)
  • Check volume I/O performance
  • Review number of concurrent users
  • Enable PHP opcode caching
  • Reduce file thumbnailing for large folders

Login Issues

Issue: Cannot log in or session expires quickly

Solutions:

  • Verify credentials are correct
  • Check session configuration in environment variables
  • Clear browser cookies and cache
  • Verify SESSION_LIFETIME setting
  • Check for timezone issues
  • Review authentication logs

File Preview Not Working

Issue: Cannot preview images or documents

Solutions:

  • Verify required PHP extensions are installed
  • Check file type is supported
  • Ensure sufficient memory for preview generation
  • Review browser console for errors
  • Check file permissions
  • Verify file is not corrupted

Upgrading FileGator

To upgrade FileGator to a new version:

Method 1: Update Dockerfile

    1. Update the version tag in your Dockerfile:

      FROM filegator/filegator:v7.8.0
    2. Commit and push the changes to your repository:

      Terminal window
      git add Dockerfile
      git commit -m "Upgrade FileGator to version 7.8.0"
      git push origin main
    3. Redeploy the application through Klutch.sh dashboard.

    4. Verify the upgrade was successful:

      • Check version in footer
      • Test file operations
      • Verify user access

Method 2: Use Latest Tag

To always use the latest stable version:

FROM filegator/filegator:latest

This automatically pulls the latest release on each rebuild.

Pre-Upgrade Checklist

  • ✅ Backup both persistent volumes
  • ✅ Review FileGator changelog for breaking changes
  • ✅ Test upgrade in a development environment
  • ✅ Notify users of scheduled maintenance
  • ✅ Document current configuration
  • ✅ Monitor logs after upgrade

Migration Strategies

Migrating from Other File Managers

To migrate from another file management system:

    1. Export User Data:

      • Export user lists and credentials
      • Document permission structures
      • Export file organization
    2. Transfer Files:

      • Use FTP, SFTP, or rsync to transfer files
      • Maintain directory structure
      • Preserve file timestamps
    3. Configure FileGator:

      • Create users in FileGator
      • Set up permissions
      • Configure home directories
    4. Validate Migration:

      • Verify all files transferred
      • Test user access
      • Confirm permissions work correctly
    5. Switch Over:

      • Update DNS or URLs
      • Notify users of new system
      • Provide training if needed

Migrating from Existing FileGator Instance

To migrate an existing FileGator deployment:

    1. Backup Current Instance:

      Terminal window
      tar -czf filegator-backup.tar.gz /path/to/repository /path/to/private
    2. Deploy New Instance on Klutch.sh following this guide.

    3. Transfer Data:

      • Extract backup to new persistent volumes
      • Verify file permissions
      • Test database connections
    4. Update Configuration:

      • Update APP_URL environment variable
      • Adjust any path-specific settings
      • Verify email settings if used
    5. Test Thoroughly:

      • Test user logins
      • Verify file access
      • Check all features work
    6. Switch DNS: Point domain to new Klutch.sh instance.


Cost Optimization

Resource Efficiency

  • Start with minimal resources and scale based on actual usage
  • Monitor resource utilization regularly
  • Right-size instances based on user count and file operations
  • Use auto-scaling if available

Storage Optimization

  • Implement file retention policies
  • Compress old files when appropriate
  • Delete duplicate files
  • Archive infrequently accessed files
  • Monitor and clean temporary files

Bandwidth Optimization

  • Optimize image thumbnails size
  • Enable compression for text files
  • Implement caching headers
  • Use CDN for frequently accessed files

Use Cases

Personal Cloud Storage

Deploy FileGator as a personal cloud:

  • Store personal documents and photos
  • Access files from anywhere
  • Share files with family and friends
  • Full control over your data

Team Collaboration

Use FileGator for team file sharing:

  • Shared project folders
  • Role-based access control
  • File versioning through manual backups
  • Secure file sharing with clients

Educational Institutions

Deploy for students and faculty:

  • Student assignment submissions
  • Course material distribution
  • Faculty file sharing
  • Secure document storage

Small Business

Implement as a business file server:

  • Department-specific folders
  • Client file sharing
  • Document management
  • Secure internal file storage

Resources


Conclusion

You now have a fully functional FileGator file manager running on Klutch.sh with persistent storage, configured users and permissions, and production-ready settings. This setup allows you to:

  • Manage files through a clean, modern web interface
  • Support multiple users with customizable permissions
  • Upload, download, and organize files efficiently
  • Share files securely with generated links
  • Edit text files directly in the browser
  • Access your files from anywhere with internet access

FileGator on Klutch.sh provides a lightweight, self-hosted file management solution that’s perfect for personal use, team collaboration, or small to medium-sized organizations. With automatic HTTPS, persistent storage, and easy scalability, you have a robust platform for all your file management needs.

For questions or community support, refer to the FileGator GitHub Issues or the official documentation.