🚀 Ultra-Fast PHP Server with Modern Features

Konfigurasi Caddy + FrankenPHP production-ready untuk Laravel dengan performa maksimal, auto-SSL, dan deployment yang mudah.


🌟 Apa itu FrankenPHP? {#frankenphp-intro}

FrankenPHP adalah web server modern yang menggabungkan:

🎯 Keunggulan FrankenPHP:

Feature Traditional PHP-FPM FrankenPHP
Startup Time ❌ Slow (process spawn) ✅ Fast (persistent)
Memory Usage ❌ High (multiple processes) ✅ Low (shared memory)
SSL Setup ❌ Manual config ✅ Auto Let's Encrypt
HTTP/2 & HTTP/3 ⚠️ Complex setup ✅ Built-in support
Real-time Features ❌ Limited ✅ WebSockets, SSE

🏗️ Basic Caddyfile Structure {#basic-structure}

📄 Minimal Laravel Setup

# Basic Laravel configuration
example.com {
    root * /var/www/laravel/public

    # FrankenPHP directive
    php_server

    # Laravel routing
    try_files {path} {path}/ /index.php?{query}

    # Security headers
    header {
        X-Frame-Options "SAMEORIGIN"
        X-Content-Type-Options "nosniff"
        X-XSS-Protection "1; mode=block"
        Referrer-Policy "strict-origin-when-cross-origin"
    }
}

🔧 Structure Explanation:

# Site block - domain configuration
example.com {
    # Document root (Laravel public folder)
    root * /var/www/laravel/public

    # Enable FrankenPHP
    php_server

    # Handle Laravel routes
    try_files {path} {path}/ /index.php?{query}
}

Key Directives:

Directive Fungsi
root * 📁 Set document root untuk semua paths
php_server ⚡ Enable FrankenPHP worker mode
try_files 🔄 Laravel routing fallback

🎯 Laravel Specific Configuration {#laravel-config}