Question

Can access through IP but can't with domain

I am using a Docker droplet and I am trying to configure Nginx as a reverse proxy. When I type my IP in the browser I can see the HTML my page, but when I use my domain (mydomain.com) it doesn’t work. I notice that with Postman I can make a GET request HTTP and it loads the HTML page, on browser always try to use an HTTPS connection.

Here is my nginx.conf:

server {
    listen 80;
    listen [::]:80;
    listen 443;
    listen [::]:443;

    server_name iamgonzales.dev www.iamgonzales.dev;

    location ~ /.well-known/acme-challenge {
        allow all;
        root /usr/share/nginx/html;
    }

    root /usr/share/nginx/html;
    index index.html;
}

Here is my docker-compose.yml

version: '3.1'

services:

  letsencrypt-nginx-container:
    container_name: 'letsencrypt-nginx-container'
    image: nginx:latest
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
      - ./letsencrypt-site:/usr/share/nginx/html
    networks:
      - docker-network

networks:
  docker-network:
    driver: bridge


Here are all my droplet open doors:

root@docker:~# netstat -tulpn | grep LISTEN
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      740/systemd-resolve
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      951/sshd
tcp6       0      0 :::80                   :::*                    LISTEN      5412/docker-proxy
tcp6       0      0 :::22                   :::*                    LISTEN      951/sshd
tcp6       0      0 :::443                  :::*                    LISTEN      5400/docker-proxy

Is there any conf that I missing??

Appreciate any help as I lost half day on this.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi, @stgonzales

Before we deep dive into troubleshooting this, can you confirm that the domain name is pointed to your droplet’s IP address?

You can use our DNS lookup tool in order to check if the domain name is resolving from your droplet:

https://www.digitalocean.com/community/tools/dns

Let me know how it goes,

Regards, Alex