MicroHost - Lightweight Mini Web Hosting & Deployment Service
MicroHost - Lightweight Mini Web Hosting & Deployment Service
Featured Project
Full Stack

MicroHost - Lightweight Mini Web Hosting & Deployment Service

Architected a minimalist cloud-based mini hosting engine that allows developers to deploy lightweight web applications and scripts with zero configuration. Designed to serve as an accessible, cost-effective micro-cloud infrastructure tool.

PhpHTMLCSSJavaScriptMySQL
README.md
Markdown

Mini Hosting Panel

A complete PHP-based mini hosting panel that allows you to upload frontend projects (HTML/CSS/JS, React, Vue, Angular) and instantly get live public URLs. Features admin authentication with Google Authenticator 2FA, online file manager with code editor, and comprehensive security.

🚀 Features

  • Secure Admin Authentication

    • Username/password login with bcrypt hashing
    • Login rate limiting (5 attempts per 15 minutes)
    • Google Authenticator (TOTP 2FA) integration
    • QR code generation for easy setup
  • Project Upload System

    • Support for multiple project types (HTML, React, Vue, Angular)
    • Folder or ZIP file upload
    • Automatic ZIP extraction
    • Unique project ID generation
    • Instant live URL generation
  • Online File Manager

    • Browse project files in tree view
    • View, edit, rename, and delete files
    • Syntax highlighting for code files
    • Real-time file editing
  • Security Features

    • Input sanitization and validation
    • PHP/executable file blocking
    • XSS and CSRF protection
    • Directory traversal prevention
    • Security headers via .htaccess
    • Activity logging
  • SPA Support

    • Automatic routing for React/Vue/Angular apps
    • Fallback to index.html for client-side routing

📋 Requirements

  • PHP 7.4 or higher
  • MySQL 5.7 or higher
  • Apache with mod_rewrite enabled
  • PHP extensions: PDO, mysqli, zip, mbstring
  • Minimum 100MB upload limit (configurable)

🛠️ Installation

Step 1: Upload Files

Upload all files to your web server (e.g., /public_html/mini-hosting-panel/)

Step 2: Create Database

  1. Create a new MySQL database (e.g., mini_hosting_panel)
  2. Import the database.sql file:
    bash
    mysql -u username -p mini_hosting_panel < database.sql

Step 3: Configure Database

Edit config/database.php and update the database credentials:

php
define('DB_HOST', 'localhost'); define('DB_NAME', 'mini_hosting_panel'); define('DB_USER', 'your_username'); define('DB_PASS', 'your_password');

Step 4: Configure Domain

Edit config/config.php and update the base URL:

php
define('BASE_URL', 'https://yourdomain.com/mini-hosting-panel'); define('PROJECTS_URL', BASE_URL . '/projects');

Step 5: Set Permissions

Set proper file permissions:

bash
chmod 755 -R /path/to/mini-hosting-panel chmod 777 /path/to/mini-hosting-panel/projects chmod 777 /path/to/mini-hosting-panel/uploads

Step 6: Access Admin Panel

  1. Navigate to https://yourdomain.com/mini-hosting-panel/
  2. Login with default credentials:
    • Username: admin
    • Password: Admin@123
  3. Scan QR code with Google Authenticator app
  4. Enter 6-digit code to complete 2FA setup
  5. IMPORTANT: Change the default password immediately!

📁 Folder Structure

mini-hosting-panel/ ├── admin/ # Admin dashboard and upload pages │ ├── dashboard.php │ ├── upload.php │ └── upload-handler.php ├── auth/ # Authentication system │ ├── login.php │ ├── totp-verify.php │ ├── logout.php │ └── TOTPHelper.php ├── config/ # Configuration files │ ├── config.php │ └── database.php ├── editor/ # File manager and editor │ ├── file-manager.php │ └── file-operations.php ├── includes/ # Helper functions │ └── security.php ├── assets/ # CSS and JavaScript │ ├── css/style.css │ └── js/main.js ├── projects/ # Uploaded projects (public access) ├── uploads/ # Temporary upload storage ├── .htaccess # Main Apache configuration ├── index.php # Landing page └── database.sql # Database schema

🎯 Usage

Uploading a Project

  1. Login to admin panel
  2. Click "Upload New Project"
  3. Enter project name
  4. Select project type (HTML/React/Vue/Angular)
  5. Choose folder or ZIP file
  6. Click "Upload Project"
  7. Copy the generated live URL

Managing Files

  1. Go to Dashboard
  2. Click "Manage Files" on any project
  3. Browse files in tree view
  4. Click file to view/edit
  5. Use buttons to rename or delete files
  6. Click "Save" to save changes

Accessing Projects

Projects are publicly accessible at:

https://yourdomain.com/mini-hosting-panel/projects/project_xxxxx/

🔒 Security Best Practices

  1. Change Default Password

    • Immediately change the default admin password after first login
  2. Use Strong Passwords

    • Use passwords with at least 12 characters
    • Include uppercase, lowercase, numbers, and symbols
  3. Enable HTTPS

    • Always use SSL/TLS certificates
    • Force HTTPS in .htaccess
  4. Restrict Admin Access

    • Consider IP whitelisting for admin panel
    • Use VPN for remote access
  5. Regular Backups

    • Backup database regularly
    • Backup uploaded projects
  6. Update PHP

    • Keep PHP and MySQL updated
    • Monitor security advisories
  7. File Upload Limits

    • Adjust MAX_UPLOAD_SIZE in config.php
    • Monitor disk space usage

⚙️ Configuration Options

Edit config/config.php to customize:

php
// Session timeout (seconds) define('SESSION_TIMEOUT', 3600); // Max login attempts define('MAX_LOGIN_ATTEMPTS', 5); // Login timeout (seconds) define('LOGIN_TIMEOUT', 900); // Max upload size (bytes) define('MAX_UPLOAD_SIZE', 100 * 1024 * 1024); // Allowed file extensions define('ALLOWED_EXTENSIONS', [...]); // Blocked file extensions define('BLOCKED_EXTENSIONS', [...]);

🐛 Troubleshooting

Upload fails

  • Check PHP upload limits in php.ini
  • Verify folder permissions (777 for projects/ and uploads/)
  • Check disk space

TOTP not working

  • Ensure server time is synchronized (NTP)
  • Check timezone in config/config.php
  • Regenerate QR code if needed

Projects not accessible

  • Verify .htaccess is enabled
  • Check mod_rewrite is enabled
  • Verify file permissions

Database connection error

  • Check credentials in config/database.php
  • Verify MySQL service is running
  • Check database exists

📝 Default Credentials

Username: admin
Password: Admin@123

⚠️ CHANGE THESE IMMEDIATELY AFTER FIRST LOGIN!

🤝 Support

For issues or questions:

  1. Check the troubleshooting section
  2. Review error logs in Apache/PHP
  3. Check activity logs in database

📄 License

This project is provided as-is for educational and personal use.

🎉 Credits

Built with PHP, MySQL, and modern web technologies.

Project Stats

11Views
Popularity100%

Features

  • 🚀 Zero-Config Deployment
  • ⚛️ Native React Support
  • 📂 Automated Sandboxing
  • 🔄 Instant Site Upload