# /etc/nginx/sites-available/version-proxy.conf
# Isolated Nginx block for the modpack version checker PHP proxy
# Hosted on Billing VPS (38.68.14.188) in its own directory
# to avoid conflicts with Paymenter (Laravel) and Mailcow routing.
#
# BEFORE ENABLING: verify port 8080 is free with `ss -tlnp`
# If 8080 is taken, change to 8081 or 8090 here AND in the HTML dashboard's PROXY_URL.

server {
    # Custom port — avoids Paymenter/Mailcow conflicts
    # Verify with: ss -tlnp | grep 8080
    listen 8080;

    server_name _;

    root /var/www/version-proxy;
    index proxy.php;

    location / {
        try_files $uri $uri/ /proxy.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        # PHP 8.3 socket (matches existing Billing VPS environment)
        fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
    }

    # Block access to config.php directly
    location = /config.php {
        deny all;
        return 404;
    }

    location ~ /\.ht {
        deny all;
    }
}
