Website Not Reachable
Quick diagnosis
First, identify the type of error:
| Error | Meaning |
|---|---|
ERR_CONNECTION_REFUSED | Web server not listening on the port |
ERR_CONNECTION_TIMED_OUT | Firewall blocks the port or server not responding |
502 Bad Gateway | Nginx can't communicate with PHP-FPM or backend |
503 Service Unavailable | Service is down or overloaded |
504 Gateway Timeout | Backend (PHP, app) taking too long to respond |
403 Forbidden | Wrong file permissions or Nginx/Apache configuration |
404 Not Found | File not found or path configuration error |
500 Internal Server Error | Application error (PHP, etc.) |
1. Is the web server running?
# For Nginx
systemctl status nginx
# For Apache
systemctl status apache2
# If it's down, start it
systemctl start nginx
If it won't start, see the guide: Service that Won't Start
2. Does firewall allow HTTP/HTTPS ports?
ufw status
Ports 80 and 443 must be open:
ufw allow http
ufw allow https
ufw reload
3. Is the web server listening on the right port?
ss -tlnp | grep -E ':80|:443'
If you see no output, Nginx/Apache is not listening on those ports. Check the configuration.
Error 502 Bad Gateway (Nginx + PHP-FPM)
502 indicates Nginx can't communicate with PHP-FPM.
# Verify PHP-FPM is running
systemctl status php8.2-fpm
# If it's down
systemctl start php8.2-fpm
# Check Nginx error log
tail -20 /var/log/nginx/error.log
Verify the .sock file in Nginx configuration matches the real one:
# See available sock
ls /run/php/
# Must match what's in configuration:
# fastcgi_pass unix:/run/php/php8.2-fpm.sock;
Error 403 Forbidden
Most common cause: wrong file permissions on files or directory.
# Fix permissions
chown -R www-data:www-data /var/www/mysite/
find /var/www/mysite/ -type d -exec chmod 755 {} \;
find /var/www/mysite/ -type f -exec chmod 644 {} \;
Another cause: index.html or index.php missing in site root.
Error 500 Internal Server Error
Check the error logs:
# Nginx
tail -50 /var/log/nginx/error.log
# Apache
tail -50 /var/log/apache2/error.log
# Application log (Laravel)
tail -50 /var/www/mysite/storage/logs/laravel.log
Common causes:
- PHP syntax error
- Missing or misconfigured .env file
- Wrong permissions on app cache or logs
- Missing PHP module
Error 504 Gateway Timeout
Backend taking too long to respond. Increase timeout in Nginx:
# In server or location block
proxy_read_timeout 120s;
fastcgi_read_timeout 120s;
Also increase max_execution_time in PHP:
nano /etc/php/8.2/fpm/php.ini
# max_execution_time = 120
systemctl restart php8.2-fpm
DNS not propagated
If site works with IP but not with domain, could be DNS propagation issue:
# Verify DNS from server
nslookup example.com
# Check on external tools
# https://dnschecker.org
Wait for propagation (up to 48 hours) or verify A record is correct in your DNS panel.
Related articles
Locked Out of VPS
Complete guide to recover server access when locked out, with step-by-step instructions from VNC Console
Server Unreachable
What to do when server is not responding or you can't connect via SSH
Disk Full
What to do when server disk is full and how to free up space quickly
