Score:0

Docker based with NginX for one appication and multiple domains

yt flag

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?

Score:0
aq flag

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.

I sit in a Tesla and translated this thread with Ai:

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.