> ## Documentation Index
> Fetch the complete documentation index at: https://help.freakhosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Fix a Website Not Loading on Your VPS

> Website not loading on your VPS? Check the web server runs and passes nginx -t, open ports 80 and 443, and make sure your domain points to the server.

When a website on your VPS doesn't load, check four things in order: the web server (Nginx or Apache) is running and its configuration is valid (`sudo nginx -t`), the firewall allows ports 80 and 443, the domain's DNS points to your server's IP, and the web server answers locally (`curl -I http://127.0.0.1`). The browser's error message tells you where to start.

```text theme={null}
This site can't be reached
ERR_CONNECTION_REFUSED
ERR_CONNECTION_TIMED_OUT
DNS_PROBE_FINISHED_NXDOMAIN
```

| Difficulty | Time | Works on | Needs |
| - | - | - | - |
| Beginner | 10 to 20 minutes | Ubuntu 22.04 / 24.04, Debian 12 / 13, AlmaLinux and Rocky Linux 9 / 10 | SSH access with sudo |

## Before you start

* Connect with [SSH](https://help.freakhosting.com/portals/other/how-to-connect-to-a-linux-server-with-ssh.md). If SSH doesn't work either, the server itself is the problem: see [SSH connection timed out](https://help.freakhosting.com/portals/other/how-to-fix-ssh-connection-timed-out.md).
* Know your server's public IP. It is on your [server page](https://help.freakhosting.com/portals/vps-panel/a-tour-of-your-server-page.md); the examples use `203.0.113.10`.
* Commands use `sudo`. As root, leave it out.

## Which error do you see?

| Browser error | Most likely cause |
| - | - |
| `ERR_CONNECTION_REFUSED` | Web server not running, or not listening on that port (Causes 1 and 4) |
| `ERR_CONNECTION_TIMED_OUT` | Firewall blocks the port (Cause 2) |
| `DNS_PROBE_FINISHED_NXDOMAIN` | The domain has no DNS record (Cause 3) |
| Another site, or a default "Welcome to nginx!" page | DNS or server block mismatch (Causes 3 and 4) |
| `502 Bad Gateway` | Nginx runs, the app behind it doesn't: see [fix 502 Bad Gateway](https://help.freakhosting.com/portals/other/how-to-fix-502-bad-gateway-nginx.md) |

## Cause 1: The web server isn't running

**Check:**

> [tab] Nginx
>
> ```bash theme={null}
> sudo systemctl status nginx
> sudo nginx -t
> ```

> [tab] Apache (Ubuntu / Debian)
>
> ```bash theme={null}
> sudo systemctl status apache2
> sudo apache2ctl configtest
> ```

> [tab] Apache (AlmaLinux / Rocky)
>
> ```bash theme={null}
> sudo systemctl status httpd
> sudo apachectl configtest
> ```

A broken configuration stops the server from starting. `nginx -t` names the file and line:

```text theme={null}
nginx: [emerg] unknown directive "retrun" in /etc/nginx/sites-enabled/example.com:12
nginx: configuration file /etc/nginx/nginx.conf test failed
```

**Fix:** correct that line until the test says `syntax is ok` (Nginx) or `Syntax OK` (Apache), then start the service, for example:

```bash theme={null}
sudo systemctl enable --now nginx
```

If the log says `Address already in use`, another program holds port 80 or 443. Find it with `sudo ss -tlnp | grep -E ':80 |:443 '`.

## Cause 2: The firewall blocks ports 80 and 443

**Check** and **fix:**

> [tab] Ubuntu / Debian (UFW)
>
> ```bash theme={null}
> sudo ufw status
> sudo ufw allow 'Nginx Full'
> ```
>
> For Apache, use `sudo ufw allow 'Apache Full'`. Both open TCP ports 80 and 443.

> [tab] AlmaLinux / Rocky (firewalld)
>
> ```bash theme={null}
> sudo firewall-cmd --list-services
> sudo firewall-cmd --permanent --add-service=http --add-service=https
> sudo firewall-cmd --reload
> ```

Also check the rules in our [Firewall panel](https://help.freakhosting.com/portals/firewall/firewall-panel-overview.md) if you use it. Test from outside with [check if a port is open from outside](https://help.freakhosting.com/portals/other/how-to-check-if-a-port-is-open-from-outside.md).

## Cause 3: The domain doesn't point to your server

**Check** from your computer or the server:

```bash theme={null}
dig +short example.com A
dig +short www.example.com A
```

If `dig` is missing, install `bind9-dnsutils` (Ubuntu/Debian) or `bind-utils` (AlmaLinux/Rocky). Both lines should print `203.0.113.10`. No output means there is no `A` record; a different IP means the record points elsewhere.

**Fix:** set `A` records for `example.com` and `www` to your server's IP at your DNS provider. Changes can take from a few minutes to the record's TTL to reach everyone. See [point a domain to your server](https://help.freakhosting.com/portals/other/how-to-point-a-domain-to-your-server.md). Test the site by IP in the meantime: `http://203.0.113.10`.

## Cause 4: The server answers locally but not for your domain

**Check** on the server:

```bash theme={null}
curl -I http://127.0.0.1
curl -I -H 'Host: example.com' http://127.0.0.1
sudo ss -tlnp | grep -E ':80 |:443 '
```

`HTTP/1.1 200 OK` (or a `301` redirect) means the web server works. If `ss` shows `127.0.0.1:80` instead of `0.0.0.0:80` or `*:80`, it only listens locally: fix the `listen` (Nginx) or `Listen` (Apache) line. If the default page appears instead of your site, `server_name` or `ServerName` doesn't match your domain. See [set up Nginx server blocks](https://help.freakhosting.com/portals/other/how-to-set-up-nginx-server-blocks.md).

On AlmaLinux and Rocky, files copied in from elsewhere can have the wrong SELinux label and give `403 Forbidden`. Run `sudo restorecon -Rv /var/www` and see [SELinux on AlmaLinux and Rocky](https://help.freakhosting.com/portals/other/how-to-use-selinux-on-almalinux-and-rocky.md).

## Cause 5: Only HTTPS fails

If `http://` works but `https://` doesn't, port 443 isn't open, nothing listens on it, or the certificate is missing or expired.

**Check:**

```bash theme={null}
curl -vI https://example.com 2>&1 | grep -iE 'expire|subject|error'
```

**Fix:** open port 443 (Cause 2) and issue or renew the certificate with [Certbot](https://help.freakhosting.com/portals/other/how-to-get-a-free-ssl-certificate-with-certbot.md).

## How to check it worked

From your computer:

```bash theme={null}
curl -I https://example.com
```

```text theme={null}
HTTP/2 200
```

## Frequently asked questions

### The site works by IP but not by domain. Why?

DNS isn't pointing to your server yet, or the server block doesn't list the domain. Check Cause 3, then Cause 4.

### The site works for me but not for others. Why?

Your computer may still use an old DNS answer, or a firewall rule allows only your IP. Test from a phone on mobile data.

### It loaded yesterday and stopped today. What changed?

Look for an expired certificate, a full disk ([no space left on device](https://help.freakhosting.com/portals/other/how-to-fix-no-space-left-on-device.md)), or a service killed for lack of memory ([OOM killer](https://help.freakhosting.com/portals/other/how-to-fix-out-of-memory-killed-processes.md)).

## Related guides

> [card] [VPS and dedicated server guides](https://help.freakhosting.com/portals/other/vps-and-dedicated-server-guides.md)
>
> Every guide in this section.

> [card] [Fix 502 Bad Gateway](https://help.freakhosting.com/portals/other/how-to-fix-502-bad-gateway-nginx.md)
>
> When Nginx can't reach your app.

> [card] [Point a domain to your server](https://help.freakhosting.com/portals/other/how-to-point-a-domain-to-your-server.md)
>
> Set A and AAAA records.

> [card] [Install Nginx](https://help.freakhosting.com/portals/other/how-to-install-nginx.md)
>
> A clean, working setup.

> [card] [Free SSL with Certbot](https://help.freakhosting.com/portals/other/how-to-get-a-free-ssl-certificate-with-certbot.md)
>
> HTTPS for your domain.

***

> [!NOTE]
>
> **Checked against the official [nginx documentation](https://nginx.org/en/docs/), the [Apache HTTP Server documentation](https://httpd.apache.org/docs/2.4/) and [Ubuntu's firewall documentation](https://ubuntu.com/server/docs/how-to/security/firewalls/)** on 4 November 2026; `nginx -t` (valid and broken config), `apache2ctl configtest`, the `curl` and `ss` checks against a test Nginx instance and the UFW profiles (dry run) were tested on Ubuntu 24.04 LTS (nginx 1.24, Apache 2.4.58). The firewalld and SELinux steps were not tested.

> [!NOTE]
>
> ### Need Extra Help?
>
> If you encounter any issues, our support team is ready to assist:
>
> * **Live Chat:** Quick assistance via our website.
> * **Support Ticket:** [Open a Ticket](https://freakhosting.com/clientarea/submitticket.php)
> * **Discord:** [Join our Community](https://discord.gg/freakhosting)
> * **Email:** [support@freakhosting.com](mailto:support@freakhosting.com)

> [!TIP]
>
> ### Save on Your Hosting
>
> Ready to upgrade your hosting? Use code **KB20** at checkout for **20% off** your first order!

***

**Last Updated:** November 2026


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.