0

I use docker with nginx image to run my site.

I have following configuration:

docker-compose.yml

version: '7.1'

services:
  #
  # Conflicts with any local HTTP server.
  # If you have a local Nginx, you must stop it.
  #
  nginx:
    image: nginx:1.12.0-alpine
    container_name: nginx
    ports:
      - "80:80"
    volumes:
      - ./files/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./files/nginx/sites-enabled:/etc/nginx/sites-enabled:ro
    network_mode: bridge

site-one.conf

upstream site-one.local {
  server host.docker.internal:9293 fail_timeout=0;
}

server {
  listen 80;
  server_name site-one.local *.site-one.local;

  client_max_body_size 50M;
  error_page 500 502 503 504 /50x.html;

  location = /50x.html {
    root html;
  }

  try_files $uri/index.html $uri @site-one.local;
  location @site-one.local {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://site-one.local;
  }
}

I have tabs in web application and when click a page is opened with new domain name site-two.local/my-page and returns error:

This site can’t be site-two.local refused to connect.

How add additional domain site-two.local for the same application?

Alex
  • 1
  • 1

1 Answers1

0

How add additional domain site-two.local for the same application?

Changing the server_name config should work... But I'm not sure if this error was caused by nginx or your application.

  server_name site-one.local *.site-one.local site-two.local *.site-two.local;

Maybe creating another block server {... for the site-two.local works too.