Score:0

nginx domain name is not showing docker

de flag

I am new experimenting with docker and nginx and it seems that i cannot make Nginx.

context:

  • there is 3 docker container run on docker compose (Nginx, frontend, and a Api backend)
  • the website works fine with the IP address
  • using the domain name redirects to the serveur IP

Problem :

I cannot make ngnix to display the name domain in the url bar, it displays the server IP

Not sure if it a docker issue or nginx conf.

THe ngnix con :

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name  domain-name.com ; 


# Frontend
location / {
    proxy_pass http://frontend-name:8080; # same name as network alias
}

# Backend
location /api {
    proxy_pass http://backend-name:5000/;  # <--- note this has an extra /
}

# You may need this to prevent return 404 recursion.
location = /404.html {
    internal;
}
}

the docker compose file :

version : "3"


networks:
  isolation-network:
    driver: bridge

services : 
  frontend :
    container_name : frontend
    build: ./PersonalWebsite
    ports :
      - 8080:8080
    networks:
           isolation-network:
              aliases:
                  - frontend-name


  backend :
    container_name : backend
    build : ./API/test
    ports :
      - 5000:5000
    networks:
           isolation-network:
              aliases:
                  - backend-name   


  nginx-proxy:
      depends_on:
          - frontend
          - backend
      image: nginx:alpine
      volumes: 
          - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
      networks:
           isolation-network:
              aliases:
                  - proxy-name
      ports:
          - 80:80
          - 443:443

any ideas ?

PS: not an experienced dev a curious guy

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.