#!/bin/bash

# Debug Server Script
# Run this on the server to check what's wrong

echo "🔍 Debugging Server Issues"
echo "=========================="

# Check Nginx status
echo "📋 Nginx Status:"
systemctl status nginx --no-pager

echo ""
echo "📋 Nginx Configuration Test:"
nginx -t

echo ""
echo "📋 Directory Structure:"
ls -la /var/www/domain-rotator/

echo ""
echo "📋 Public Directory:"
ls -la /var/www/domain-rotator/rotator-jago/app/public/

echo ""
echo "📋 PHP-FPM Status:"
systemctl status php8.4-fpm --no-pager

echo ""
echo "📋 Nginx Error Log:"
tail -20 /var/log/nginx/error.log

echo ""
echo "📋 PHP-FPM Error Log:"
tail -20 /var/log/php8.4-fpm.log

echo ""
echo "📋 Test PHP:"
php -v

echo ""
echo "📋 Test Composer:"
composer --version

echo ""
echo "📋 Test MySQL:"
systemctl status mysql --no-pager

echo ""
echo "✅ Debug completed!"
