E
E
EVOSandru62018-11-23 10:03:20
Docker
EVOSandru6, 2018-11-23 10:03:20

How to configure /etc/hosts site on docker on VPS?

Good afternoon,
There is docker-compose.yml:

version: '3.7'
services:
  nginx:
    container_name: nginx
    build:
      context: ./
      dockerfile: docker/containers/nginx/Dockerfile
    volumes:
      - ./app:/var/www
    ports:
      - 80:80
      - 443:443
...

docker/containers/nginx/Dockerfile:
FROM nginx:1.10
ADD ./docker/nginx/default.conf /etc/nginx/conf.d/default.conf
WORKDIR /var/www

docker/nginx/default.conf:
server
{
    listen 80;

    index index.php index.html;
    root /var/www/public;

    location / {
        try_files $uri /index.php?$args;
    }

    location /docs {
        try_files $uri $uri/;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php-fpm:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

The domain is already looking at the IP Address of this VPS hosting. Before there was a docker on it, deployed LENP, turned to the right address, everything opened.
On VPS - /etc/hosts
127.0.0.1       localhost
# {v.p.s.ip} vps41742912.local vps41742912

Completed:
docker-compose up
Everything is assembled. Locally deployed, worked with the site on localhost:80
But at the specified domain address it says:
This site can't be reached The webpage at https://{domen}.ru/ might be temporarily down or it may have moved permanently to a new web address.
ERR_TUNNEL_CONNECTION_FAILED

What could be causing the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chupasaurus, 2018-11-23
@chupasaurus

extra_hosts
Cause of the problem - the image does not contain your /etc/hosts

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question