0

I have an app that create a subdomain with optimized front-end for every user (panel.userdomain.com). I config my dns server but i don't know how to config nginx to map a container. I explain my process

  1. register user, submit a domain, dns server (bind9) config,
  2. select a template for front-end and optimize it
  3. create a docker container with domain name
  4. ******** config nginx ************ NGINX Configuration I want when a client type panel.userdomain.com and come to my nginx, map him/his to optimized front-end container.
Lord Johar
  • 119
  • 2
  • 7
  • First of all, you should let Nginx know the new container with specific name. Have you achieved that? – Light.G Jan 14 '19 at 02:22
  • Did you mean the configuration in default.conf – Lord Johar Jan 14 '19 at 07:43
  • No, I mean you should let nginx be aware about the creation of containers, if not, how could nginx know which container it should map requests to? – Light.G Jan 14 '19 at 08:41
  • I run a shell script to config and reload nginx service. My Problem is in nginx configuration to serve container :( – Lord Johar Jan 14 '19 at 12:29
  • According to your post, especially in 4) part, I could see clients have already typed the right domain name. All you want to do is mapping the request to right container. For example, a client request your website with user named tom, so it would type `panel.tom.com/some/uri` ? – Light.G Jan 14 '19 at 14:02
  • When a client type `panel.tom.com/some/uri` the request map to tom's _front-end_ _container_ – Lord Johar Jan 15 '19 at 05:36
  • 1
    I assume that Nginx need not do anything. Since you’ve already submit `panel.tom.com` to dns server, so Nginx should know it too. So just make Nginx proxy_pass $schema$http_host$uri, it should work. – Light.G Jan 15 '19 at 09:11

0 Answers0