I’ve started a nginx webserver recently with Ubuntu Server 22.04 as usual. The hypervisor is VMware Workstation 16.2.4. When I open the site http://192.168.0.213 I can see the default nginx page. But if I try to use my domain name example.com page won’t be found… I make attempts on my host and on other virtual machines using curl. The result is the same. And I’m not able to open my site even from webserver! The command nginx -t output is successful.
obfuscateduser@dnsserver:~$ curl http://example.com
curl: (7) Failed to connect to example.com port 80 after 0 ms: Connection refused
obfuscateduser@webserver:~$ curl http://example.com
curl: (7) Failed to connect to example.com port 80 after 1 ms: Connection refused
/etc/nginx/sites-available/example.com
server {
listen 80;
listen [::]:80;
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ =404;
}
}
/var/www/example.com/html/index.html
<html>
<head>
<title>Welcome to EXAMPLE.COM!</title>
</head>
<body>
<h1>Success! The your_domain server block is working!</h1>
</body>
</html>
Permissions
obfuscateduser@webserver:~$ ll /var/www/example.com/html/
total 12
drwxr-xr-x 2 obfuscateduser obfuscateduser 4096 Jan 12 12:00 ./
drwxr-xr-x 3 root root 4096 Jan 11 17:19 ../
-rw-rw-r-- 1 obfuscateduser obfuscateduser 172 Jan 12 11:39 index.html
Firewall output
Status: active
To Action From
-- ------ ----
Nginx HTTP ALLOW Anywhere
OpenSSH ALLOW Anywhere
Nginx HTTP (v6) ALLOW Anywhere (v6)
OpenSSH (v6) ALLOW Anywhere (v6)
Should I shut down the firewall? Or should I add a special entry in DNS zones files? Might I add some other records to the example.com file?