Troubleshooting when your website is offline – Linux


Troubleshooting when your website is offline – Linux

You are here:


This article details a few checks you can make if your website is offline and hopefully help determine the root cause to help you get it back online.  This guide has been written for linux operating systems but is not specific to a distribution so should work for RHEL, CentOS, Debian servers etc.


Check if the server is online

Normally the quickest and easiest thing to do first is to ping your server to see if it is responding. This is done from an external machine, most likely the one you are trying to use to access your website.



also try

ping your_server_ip

If it responds to ping on the server ip but not the dns name, then it is most likely a DNS issue. If it does not respond to ping on either, then that would indicate an issue to the whole server  not just the website. This could be a power, network or firewall issue.

To test DNS, you can run the dig command to make sure the IP is correct, e.g.

# dig A +short

This will return the IP address which should be your server. If nothing is returned, then the DNS servers do not have your DNS record.

If you don’t have dig or similar, then you can use online sites such as to check.

Access the server with SSH

You should also be able to SSH and login to the server to verify running. You can access your server via ssh with below command

ssh username@your_server_ip

if you are not able to login to your server then the server may be hanging and in need of a reboot.

Check the server status via SSH

If you can log in then you will want to check the status of your server and services/

Check the server load

Run the following to check the load (also shows example output):

# uptime
11:14:12 up 21 min, 1 user, load average: 0.07, 0.23, 0.39

the numbers after the load average are: average load last 1 minute, average load last 5 minutes, average load last 15 minutes.

Depending on the number of CPU cores you have will determine how much load your server is under. For example if you had 8 cores and the load average was 11 then your server is overloaded as the load is higher than the number of cores.

You can also run the following to check load and the processes taking up the most load time:

# top

example output

Make sure your web server is running

Use systemctl status command to check if the running or not. You can also restart the service if needed.

If you’re using a distribution that refers to Apache as Apache2:

systemctl status apache2

To start, stop, restart and reload

systemctl status apache2
systemctl stop apache2
systemctl restart apache2
systemctl reload apache2

Reload will just re-read the config file which is useful to do to not disrupt the web service.

If you’re using a distribution that refers to Apache as httpd:

systemctl status httpd
systemctl start httpd
systemctl stop httpd
systemctl restart httpd
systemctl reload httpd

And if you are running Nginx as your web service:

systemctl status nginx
systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl reload nginx


Check the Logs

Take a look at the webserver logs to identify specific issues.

The logs will be usually present at directory /var/log . There could a subdirectory containing the logs, usually apache, apache2 or httpd depending on your Linux distro, otherwise:


If you are using Nginx as your web server, the logs are usually located at below location


To get a realtime look at the logs, you can watch the logs using the tail command:

tail -f /var/log/nginx/access.log
tail -f /var/log/httpd.log

make sure to change the to the correct log path.

Verifying the Syntax of Web server

If your web server is failing to start, it may be due to incorrect syntax in the webserver configuration file.

Use one of the following to check your config:

apache2ctl -t
httpd -t
nginx -t

If you need to make changes to the configuration (make sure to backup the file first):

Default Configuration Directories for Apache is

Debian and Ubuntu distributions :


Fedora, CentOS distributions :


Configuration Directories for Nginx is


Once you run the above command you will get message like Syntax OK or Test is successful.

Check the database

If you have configured your website to use a database backend, then the issue may be due to the database server.

Run one of the following to determine if the database is running:

systemctl status mysql
systemctl status mysqld
systemctl status mongod

The stop, start and reload commands will also work.

You can also verify with the netstat command

netstat -ntlp | grep mysql

If mysql is running, you will get something similar to this:

tcp6 0 0 :::3306 :::* LISTEN 3722/mysqld


Previous Troubleshooting Network issues using MTR
Next Working with Logical Volumes (LVM)
Table of Contents