server {

    listen 80;

    server_name bussus.com www.bussus.com;


    # Frontend: Next.js app

    location / {

        proxy_pass http://localhost:3000;

        proxy_http_version 1.1;

        proxy_set_header Upgrade $http_upgrade;

        proxy_set_header Connection 'upgrade';

        proxy_set_header Host $host;

        proxy_cache_bypass $http_upgrade;

    }


    # Admin panel: PHP

    location /admin/ {

        alias /var/www/bussus/admin/;

        index index.php;


        try_files $uri $uri/ /index.php?$args;


        location ~ \.php$ {

            include snippets/fastcgi-php.conf;

            fastcgi_pass unix:/run/php/php8.3-fpm.sock;

        }

    }


    # Optional: Block access to hidden files

    location ~ /\. {

        deny all;

    }

}