Nginx use a custom domain name

  dockerfile, nginx

I’m a beginner with nginx and I just created a server, I can access it through localhost on my browser but when I put my custom domain name it doesn’t work, I just get the message "this site is not accessible", here are my server config and my Dockerfile

— ft_server.conf —

server {
        autoindex on;

        listen 80 default;
        listen [::]:80 default;

        root /var/www/ft_server/html;
        index index.html;

        server_name ft_server localhost;

        location / {
                try_files $uri $uri/ =404;

— Dockerfile —

FROM    debian:buster

ARG     SHARED=/var/www/ft_server
RUN     mkdir -p ${SHARED}

RUN     apt-get update && apt-get upgrade -y && apt-get install -y wget tar

RUN     apt-get install -y nginx
RUN     mkdir -p /var/www/ft_server/html
RUN     chown -R $USER:$USER /var/www/ft_server/html
ADD     /srcs/conf/ft_server.conf /etc/nginx/sites-available
RUN     ln -s /etc/nginx/sites-available/ft_server.conf /etc/nginx/sites-enabled/
ADD     /srcs/conf/nginx.conf /etc/nginx
RUN     rm -f /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default

I’m running my container by doing:

docker build -t ft_server .
docker run -ti -p 80:80 ft_server:latest

then inside of my container:

service nginx start

When I see nginx tutorials it seems like it’s supposed to work for custom domain names but I don’t know why it doesn’t for me, thanks for your help

Source: Dockerfile Questions