server {
    listen 80;
    server_name hadiyahbazar.com www.hadiyahbazar.com;
    root /var/www/hadiyahbazar/public;
    index index.php;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";

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

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php8.3-fpm.sock;   # match your PHP version
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* { deny all; }
}

# After running certbot, HTTPS is added automatically:
#   sudo certbot --nginx -d hadiyahbazar.com -d www.hadiyahbazar.com
