Skip to content
Hosting Operations5 min read

Website Down Not Working: 6 Fixes That Actually Work

Fix website down not working errors by checking DNS, disk space, and PHP limits. This guide provides 6 practical steps to restore uptime fast.

Written by Abdul AbrorTechnical Hosting Support Engineer
a computer screen with the words nothing great is made alone
On this page

TL;DR — Key takeaways

  • Check DNS resolution and server disk space before assuming code errors; these are the most common causes of 'website down' issues.
  • A 502 Bad Gateway error usually indicates a PHP-FPM process crash or timeout, not a network failure.
  • Increase PHP memory limits and max execution time only after verifying current usage to avoid masking memory leaks.
  • Always create a database and file backup before applying configuration changes to production servers.
  • Monitor resource usage trends over 24 hours to distinguish between transient spikes and chronic bottlenecks.

When a customer reports 'website down not working,' the first instinct is to check the code. But in my support experience, the culprit is rarely the application itself. It’s usually infrastructure: DNS, disk space, or PHP limits.

This guide walks through six practical fixes that resolve most 'website down' issues. Each step includes how to verify the result and when to apply it. No fluff, just the checks that actually matter.

1. Verify DNS Resolution First

Before touching server configs, confirm DNS is resolving correctly. If the domain doesn’t point to the right IP, no amount of server tuning will help. Use dig or nslookup to check the A record.

If the IP is wrong, update the DNS record at your registrar. Propagation can take up to 48 hours, though it’s often faster. If the IP is correct but the site is still down, move to the next step.

  • Run: dig +short yourdomain.com A
  • Compare the returned IP with your server’s public IP
  • Check TTL values; lower TTLs speed up propagation but increase DNS load

2. Check Disk Space and Inode Usage

A full disk is the most common cause of sudden outages. When the filesystem is 100% full, the web server can’t write logs or temporary files, causing immediate failures. Run df -h to check usage.

If disk usage is above 80%, clean up old logs, unused files, or database backups. Also check inode usage with df -i; a full inode table can cause failures even if disk space remains.

  • Run: df -h to check disk usage
  • Run: df -i to check inode usage
  • Clear old logs: find /var/log -name '*.gz' -mtime +30 -delete
  • Remove unused temporary files in /tmp

3. Review Web Server Error Logs

The error log tells you exactly what failed. For Apache, check /var/log/apache2/error.log. For Nginx, check /var/log/nginx/error.log. Look for the timestamp matching the outage.

Common entries include 'PHP Fatal error,' 'Connection refused,' or 'Too many open files.' Each points to a different fix. If you see 'PHP Fatal error: Allowed memory size exceeded,' move to step 4.

  • Apache: tail -n 50 /var/log/apache2/error.log
  • Nginx: tail -n 50 /var/log/nginx/error.log
  • Search for specific errors: grep 'Fatal error' /var/log/apache2/error.log
  • Note the timestamp to correlate with user reports

4. Tune PHP-FPM and Memory Limits

A 502 Bad Gateway error usually means PHP-FPM crashed or timed out. First, restart the service to clear stuck processes. If the error returns, check the PHP error log for memory or timeout issues.

Increase memory_limit and max_execution_time in php.ini only if current usage is near the limit. Setting these too high can mask memory leaks and exhaust server RAM. Always test with a small increase first.

  • Restart PHP-FPM: systemctl restart php-fpm
  • Check PHP error log: tail -n 50 /var/log/php-fpm/error.log
  • Edit php.ini: memory_limit = 256M (start with 128M if unsure)
  • Edit php.ini: max_execution_time = 60 (default is often 30)
  • Restart PHP-FPM after changes

5. Optimize Database Queries

Slow database queries can cause timeouts, especially on shared hosting. Enable query logging in MySQL or MariaDB to identify the culprit. Look for queries that take longer than 1 second.

Add indexes to frequently queried columns. Avoid SELECT * in production code; fetch only the columns you need. If the database is on a separate server, check network latency between the web server and database host.

  • Enable query log: SET GLOBAL slow_query_log = 'ON';
  • Check slow queries: mysql -u root -p -e 'SHOW GLOBAL STATUS LIKE "Slow_queries";'
  • Add indexes to high-traffic tables
  • Use EXPLAIN to analyze query performance

6. Monitor and Prevent Recurrence

Fixing the immediate issue is only half the job. Set up monitoring to catch problems before they cause outages. Track CPU, RAM, disk usage, and PHP-FPM process count.

Use tools like Prometheus, Grafana, or your hosting provider’s monitoring dashboard. Set alerts for disk usage above 80%, CPU above 90% for 5 minutes, and PHP-FPM process count near the limit. Review these metrics weekly.

  • Set up disk usage alerts at 80%
  • Monitor CPU and RAM usage trends
  • Track PHP-FPM process count and restart threshold
  • Review error logs daily for new patterns
  • Schedule automated backups before major changes

Quick troubleshooting checklist

  • Verify DNS records resolve correctly using dig or nslookup.
  • Check server disk usage with df -h and clear unnecessary logs if over 80%.
  • Review web server error logs for specific error codes (500, 502, 503).
  • Test PHP-FPM process status and restart the service if unresponsive.
  • Increase PHP memory_limit and max_execution_time in php.ini if needed.
  • Enable database query logging to identify slow queries causing timeouts.
  • Create a full backup before applying any configuration changes.
  • Monitor CPU and RAM usage for 24 hours after fixes to confirm stability.

FAQ

Why does my website show 'down not working' even though the server is online?

This usually happens when DNS records are misconfigured, the web server process is crashed, or PHP-FPM is timing out due to resource limits. Check DNS resolution first, then review web server error logs for specific failure codes.

What is the safest way to fix a 502 Bad Gateway error?

First, restart the PHP-FPM service to clear stuck processes. If the error persists, check the PHP error log for memory or timeout issues. Only increase PHP memory limits after confirming the current usage is near the limit.

How do I know if my website is down due to a server issue or a code problem?

Check the HTTP status code. A 500 or 502 error points to a server or PHP configuration issue. A 404 or 503 error might indicate missing files or application-level errors. Review the web server error log to see the exact failure reason.