Search code examples
ubuntucurldnsiptablesnftables

Unable to GET nginx welcome page from Hetzner Ubuntu 24.04. LTS server with custom domain and docker


I am trying to set up a server and have problems GETing the standard nginx welcome page.

My setup:

  • Hetzner VPS with Ubuntu 24.04. LTS and Docker
  • I did basic server hardening (updated ubuntu, restricted ssh root access, changed ssh port, set up Fail2Ban)
  • I did not touch iptables / nftables yet (see screenshots below), there is no firewall active in the Hetzner cloud console
  • I bought a domain and changed DNS settings (two A and two AAAA entries) in the Hetzner DNS console (see picture below). I waited a day and get now the correct ip addresses on my local machine, when running nslookup for my domain (e.g. nslookup example.com)
  • Docker is running on the Ubuntu server with the official nginx image (docker run -it --rm -d -p 8080:80 nginx)
  • I can ping the domain from my local machine and see the matching logs on my Ubuntu server with tcpdump ip proto \\icmp

My problem:

I can not connect to port 8080 of my server, to see the standard welcome page of nginx.

  • curl example.com returns Connection refused for IPv4 and Network is unreachable for IPv6
  • Postman returns Error: connect ECONNREFUSED for the call GET examlpe.com
  • Browser (Firefox 129.0.2) is unable to load the page, the developer tools show the error NS_ERROR_CONNECTION_REFUSED

Did I miss something? How can I debug this issue further?

Screenshots:

iptables

nftables

hetzner DNS console entries

hetzner dns entry (textfile)


Solution

  • I found the problem:

    1. I had no firewall in place in the hetzner cloud console. Hetzner blocks all inbound traffic in case of no firewall. So I added a firewall and allowed ports for http, https and ssh.
    2. My DNS entry for the IPv6 address was wrong. I used (example address) 2222:2222:2222:2222:: (wrong) instead of 2222:2222:2222:2222::1 (correct).
    3. I changed the mapping of the docker ports, to 80 instead of 8080 (docker run -it --rm -d -p 80:80 nginx).

    Thanks reddit user u/namesisfortombstones for some helpful hints!

    Now I am finally able to see the nginx welcome page from the browser.