How To Troubleshoot When your site is down on a Linux Server

Troubleshoot when your site is down on a Linux server using ping, logs and service checks

Post Date: December 26, 2020
Last Updated: November 25, 2026

Introduction

This guide explains how to troubleshoot when your site is down on a Linux server. Downtime usually has a small number of causes: the server is unreachable, the disk or memory is full, a service has stopped, the configuration has an error, or a port is blocked. Checking them in order finds the cause faster than restarting services at random.

The original guide listed the right checks in one long numbered list. This version groups them into nine steps, replaces old commands (service, telnet) with current ones, corrects the Apache and Nginx log paths, and adds checks for DNS, disk space, memory and PHP-FPM, plus exact error messages.

Warning: Before you troubleshoot when your site is down, read the logs first. Restarting services or rebooting the server right away can erase the evidence you need. Back up any configuration file before you edit it, and take extra care on a production server.

Prerequisites

Before you troubleshoot when your site is down, make sure you have:

  • Root or sudo access over SSH, or your provider’s web console if SSH does not work
  • The server IP address and the domain name
  • The web server you use (Nginx or Apache), the database (MySQL, MariaDB or MongoDB) and whether you run PHP-FPM
  • Access to your cloud or hosting dashboard, to check the instance state and the firewall or security group
  • A backup or snapshot, before you change any configuration

Architecture

A request from a visitor passes through several layers. A fixed order of checks to troubleshoot when your site is down works because the first failing layer is usually the cause.

  • DNS: turns the domain name into your server’s IP address
  • Network and firewall: the server must be reachable, and ports 80 and 443 must be open in the firewall and the cloud security group
  • Web server: Nginx or Apache listens on ports 80 and 443 and serves the request
  • Application runtime: PHP-FPM or your app server runs the code
  • Database: MySQL, MariaDB or MongoDB answers the application, and MySQL listens on port 3306
  • System resources: disk space, memory and CPU sit under everything, and a shortage in any one of them can take the whole site down

The workflow is to test from the outside in. Start with what a visitor sees, then work through each layer until one fails.

The image below shows the request path. For the official references, see the Nginx beginner’s guide and the apachectl documentation.

Steps to Troubleshoot When Your Site Is Down on a Linux Server

1. Confirm the Problem

The first step to troubleshoot when your site is down is to see what a visitor sees. Replace example.com with your domain:

curl -I -m 10 https://example.com

The result tells you where to look:

  • HTTP/2 200 means the site is up, so the problem may be your browser, cache or network
  • HTTP/2 502, 503 or 504 means the web server answers but the application behind it fails (Step 7)
  • Could not resolve host points to DNS (Step 2)
  • Connection refused means nothing is listening on that port (Steps 4 and 8)
  • Connection timed out means the server is down or a firewall blocks the port (Steps 2 and 8)

Also test from a different network or a free “down for everyone” checker, to rule out a problem on your own side.

2. Check That the Server and DNS Respond

Test the server by its IP address (replace 1.2.3.4):

ping -c 4 1.2.3.4
ssh user@1.2.3.4

A normal reply looks like 64 bytes from 1.2.3.4: icmp_seq=1 ttl=49 time=30 ms. No ping reply does not always mean the server is down, because many servers block ping on purpose. If SSH also fails, check the instance state in your provider dashboard and open the web console. The server may be stopped, hung or out of memory.

To troubleshoot when your site is down at the DNS level, check that the domain points to the right IP:

dig +short example.com

If the answer differs from your server IP, fix the DNS record. If the site works by IP but not by domain, DNS is the cause.

3. Check Disk Space, Memory and Load

Log in and check the resources. A full disk or no free memory stops many services:

df -h
df -i
free -h
uptime
sudo dmesg -T | grep -i "out of memory"

df -h shows disk usage and df -i shows inode usage. A partition at 100% in either one is a likely cause. dmesg shows whether the kernel killed a process because memory ran out.

4. Check the Web Server Service

Check whether Nginx or Apache is running. The service name depends on your system:

  • Nginx: nginx
  • Apache on Debian and Ubuntu: apache2
  • Apache on RHEL, AlmaLinux and Rocky Linux: httpd
sudo systemctl status nginx
sudo systemctl status apache2
sudo systemctl status httpd

If the service is stopped, start it. The older service nginx start form also still works:

sudo systemctl start nginx

If it will not start, run sudo journalctl -u nginx -n 50 --no-pager and read the last lines. Use apache2 or httpd in place of nginx for Apache.

5. Test the Web Server Configuration

A syntax error stops the web server from starting or reloading. Use the command for your server:

sudo nginx -t
sudo apachectl configtest
sudo httpd -t

On Debian and Ubuntu, apache2ctl configtest is the same check. A good result says syntax is ok and test is successful. A failure names the file and line number, so open that file, fix the error, and test again before you reload.

6. Read the Error Logs

Logs are the fastest way to troubleshoot when your site is down, because they usually name the cause. The default locations are:

  • Nginx: /var/log/nginx/error.log and /var/log/nginx/access.log
  • Apache on Debian and Ubuntu: /var/log/apache2/error.log
  • Apache on RHEL-based systems: /var/log/httpd/error_log

Read the newest lines, or follow them live while you reload the page:

sudo tail -n 50 /var/log/nginx/error.log
sudo tail -f /var/log/nginx/error.log

7. Check the Database and PHP-FPM

Many “down” sites are really a stopped database or application runtime. Check them:

sudo systemctl status mysql
sudo systemctl status mariadb
sudo systemctl status mongod
sudo systemctl status php-fpm

On some systems, the service is mysqld or php8.2-fpm with your version number. If a service is stopped, start it with sudo systemctl start <name>. If it will not start, read its log, for example:

sudo tail -n 50 /var/log/mysql/error.log

8. Check Ports and the Firewall

Blocked ports are a classic reason to troubleshoot when your site is down. First check that the services listen locally on the server:

sudo ss -tlnp | grep -E ':(80|443|3306)'

Then test from another computer. This replaces the old telnet check:

nc -zv 1.2.3.4 80
nc -zv 1.2.3.4 443

If a port works locally but not from outside, check the server firewall and the cloud security group:

sudo ufw status
sudo firewall-cmd --list-all

Note: Port 3306 should listen only on the server itself, unless you need remote database access. Do not open it to the whole internet.

9. Confirm the Site Is Back

After the fix, repeat the test from Step 1:

curl -I -m 10 https://example.com

You should see HTTP/2 200. Open the site in a private browser window, and clear any CDN cache if you use one. Keep tail -f on the error log for a few minutes to make sure the problem does not return. Then write down the cause and the fix, and set up uptime monitoring so you hear about the next outage first.

Troubleshooting

If you cannot find the cause when you troubleshoot when your site is down, match the message you see:

  • “ERR_CONNECTION_REFUSED” or “Connection refused”: The web server is stopped or not listening on port 80 or 443. Check Steps 4 and 8
  • “ERR_CONNECTION_TIMED_OUT” or “Connection timed out”: The server is down, or a firewall or security group blocks the port. Check Steps 2 and 8
  • “502 Bad Gateway”: The web server cannot reach the application behind it, for example a stopped PHP-FPM. Check Step 7 and the error log
  • “503 Service Unavailable”: The backend is stopped, overloaded or in maintenance mode. Check the load in Step 3 and the logs in Step 6
  • “504 Gateway Timeout”: The application takes too long to answer. Look for slow queries, high load or too few PHP-FPM workers
  • “Error establishing a database connection”: This WordPress message means the database is stopped, or the credentials in wp-config.php are wrong. Check Step 7
  • “nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)”: Another process holds port 80. Find it with sudo ss -tlnp | grep :80, then stop it or change its port
  • “No space left on device”: The disk or its inodes are full. Free space, then restart the failed service
  • “Out of memory: Killed process”: The kernel stopped a service to free memory. Add RAM or swap, and find the process that uses the most memory
  • You cannot log in to the server at all: The server may be hung or stopped. Use your provider’s web console, or reboot it from the dashboard as a last step

Conclusion

To troubleshoot when your site is down, work from the outside in: test with curl, confirm the server and DNS respond, check disk and memory, then the web server, configuration, logs, database and ports. Read the logs before you restart anything, and confirm the fix with curl at the end. Following the same order every time turns a stressful outage into a short checklist.

Frequently Asked Questions (FAQs)

What should I check first to troubleshoot when your site is down?
Run curl -I against the domain. The status code or error message tells you whether the problem is DNS, the network, the web server or the application.

Why can’t I ping my server when the site works?
Many servers and cloud providers block ping (ICMP) on purpose. Test with curl or nc -zv on ports 80 and 443 instead.

Should I restart the server first?
No. A reboot can clear the logs and the evidence of what failed. Check resources, services and logs first, and reboot only as a last step.

How do I find out why Nginx or Apache will not start?
Run sudo nginx -t or sudo apachectl configtest for syntax errors, then read journalctl -u nginx -n 50 (or apache2, httpd) and the error log.

How can I know sooner next time?
Use an uptime monitoring service that checks your site every minute and sends an alert by email or chat. Also monitor disk space, because a full disk is a common hidden cause.

How to Solve Boot Partition Full Issue in CentOS

How to Block IPs via .htaccess File

Talk to Our Technology Experts

Tired of unexpected downtime on your website or server? Our team can monitor, maintain, and quickly fix your Linux hosting environment through our Software Maintenance and Support services.

Connect with our technology experts.

admin

Our team has expertise across software and web development, WordPress, e-commerce, mobile applications, UI/UX, cloud and infrastructure, DevOps, CI/CD, API integration, security, testing, automation, and technical support. The team also works with AI-based software solutions, LLMs, AI workflows, AI agents, and intelligent application development to help businesses automate processes and build smarter digital solutions. We focus on developing, deploying, maintaining, and optimising secure, scalable, and reliable technology solutions while helping businesses adopt modern technologies and drive digital transformation.

Leave a Comment

Scroll to Top