Support Online
Skip to main content

Linux Website Troubleshooting Guide

Websites running on Linux servers may occasionally become inaccessible, show errors, or not work properly due to incorrect configurations.
In this guide, you'll learn step by step how to detect and fix common site problems on a Linux server.

What Will You Learn in This Guide?

  • Finding the source of the error using log files
  • Verifying Apache/Nginx service status
  • Detect configuration syntax errors
  • Solving port and firewall obstacles
  • Analyze DNS errors
  • Fixing DocumentRoot and index file problems
  • Resolve file permissions and ownership issues
  • How to diagnose if the database is not working

1. Examine Log Files (Always the First Step)

Instead of randomly searching for the problem, look at the log files.
Almost all services store their logs under /var/log.

Apache logs

ls /var/log/apache2
  • Lists Apache error and access logs.

1. Nginx logs


ls /var/log/nginx
  • Shows log files of Nginx.

2. Database logs

  • MySQL, PostgreSQL and MongoDB logs are also in the same directory.

  • Searching for the error in the logs on a search engine often gives a direct solution.

2. Is the Web Server Installed and Working?

2.1 – Is the server installed?

1. Apache installation (Ubuntu/Debian)


sudo apt update
sudo apt install apache2
  • Installs Apache and creates the necessary service files.

2. Nginx installation (Ubuntu/Debian)


sudo apt install nginx
  • Installs Nginx web server.

3. Apache installation (RHEL/Rocky/Fedora)


sudo dnf install httpd
  • Installs Apache in RPM-based distributions.

2.2 – Is the server running?

1. Check if ports are listened to


sudo netstat -plunt | grep nginx
  • Indicates whether Nginx processes are listening on port 80/443.

2. Starting the service


sudo systemctl start nginx
  • Starts Nginx.

3. Check the status of the service:


sudo systemctl status nginx
  • Indicates whether the service is active or not.

3. Verify Configuration Syntax (Syntax Test)

Incorrect syntax prevents the web server from starting.

1. Apache configuration test


sudo apache2ctl bashigtest

-Tests the syntax of Apache configuration files.

2. Nginx configuration test


sudo nginx -t
  • Verifies Nginx configuration and reports error line.

Most common Nginx error: end of line; forget to add.

4. Are the Ports Open? Firewall Problems

  • For websites to be live, ports 80 and 443 must be open.

  • Port test (from external machine)


nc -z 192.168.1.10 80
  • Checks whether there is access to Port 80.

If there is no access → UFW, iptables or cloud security groups may be blocking it.


5. Are DNS Settings Correct?

  • If your domain name is not directed to the correct IP address, the site will not open.

1. DNS A record check


host -t A ornek.com

2. Shows the IPv4 address of the domain.

3. AAAA registration (IPv6)


host -t AAAA ornek.com
  • Shows the IPv6 address of the domain.

DNS changes typically propagate within 30–60 minutes.


6. Are Virtual Host / Server Block Settings Correct?

  • Even if the DNS is correct, the web server may not respond to the domain request.

1. Apache example


<VirtualHost *:80>
ServerName ornek.com
ServerAlias www.ornek.com
DocumentRoot /var/www/ornek.com
</VirtualHost>
  • Determines from which directory the site's files will be read.

  • Nginx example


server {
listen 80;
server_name ornek.com www.ornek.com;
root /var/www/ornek.com;
}
  • Defines which domains the server will respond to.

7. Is DocumentRoot / Root Directory Correct?

  • Wrong file directory → the site appears empty or gives an error.

1. Apache:


DocumentRoot /var/www/ornek.com
  • Determines what to read and where to read it.

2. Nginx:


root /var/www/ornek.com;
  • Defines the home directory.

8. Index File Problems

  • If index.html / index.php does not exist, the server may try to list the directory.

1. Apache:


DirectoryIndex index.html index.php
  • Specifies which file Apache will search for first.

2. Nginx:


index index.html index.htm;
  • Nginx's default index file list.

9. File Permissions and Ownership Problems

  • Incorrect permissions → 403 Forbidden, blank page or file cannot be read error.

1. Check file permissions


ls -l /var/www/ornek.com
  • Shows user and group permissions of files.

2. Fix ownership


sudo chown -R www-data:www-data /var/www/ornek.com
  • Allows the web server to read the contents.

10. Check Access Restrictions

1. Apache access denial example


Require all denied
  • This completely closes access to the directory.

2. Nginx access block example


deny all;

Blocks access to the requested directory.

  • If placed incorrectly → the entire site may go down.

10.1 Is the Database Service Running?

  • Your site uses MySQL, PostgreSQL etc. If it uses it, the database must be working.

1. MySQL check


sudo netstat -plunt | grep mysql
  • Indicates whether MySQL is listening on the port.

10.2 Can the Site Connect to the Database?

  • If the connection information is incorrect, the site will give an error.

1. Manual connection test


mysql -u DB_USER -pDB_PASS DB_NAME

It allows you to check whether the database information is correct.

  • If you cannot connect → there is a password, user permissions or host problem.

Frequently Asked Questions (FAQ)

1. My website is not opening but the server is working. Why? The document root may be incorrect, DNS may be incorrect, or the firewall may be blocking the ports.

2. Apache/Nginx is running but the page is white. Solution? Look at the log files. It is usually caused by PHP errors.

3. The site opens with IP but the domain does not work. Reason? Virtual Host/Server Block may be misconfigured.

4. Why are file permissions so critical? If the web server cannot read the files, the page will appear blank or with a 403 error.

5. Why aren't DNS changes updated immediately? DNS propagation is global and takes time. It usually takes 30–60 minutes.


Result

In this guide, you learned all the steps needed to systematically and quickly fix website problems on a Linux-based server. You can now solve many problems on your own, including log analysis, configuration verification, DNS control, permission management and database problems.

You can safely use GenixNode infrastructure for uninterrupted and high-performance web projects.