search

Home  >  Q&A  >  body text

linux - How to configure nginx custom domain name access in docker?

Environment Ubuntu 16.04, you can successfully access the nginx container through port 80, the shared directory between the container and the host is ~/web

Currently we want to implement: customize two domain names a.com
and b.com, and request the ~/web/a and ~/web/b directories respectively by accessing these two custom domain names

Please tell me how to set the host hosts and nginx container hosts files, and how to configure the conf file of the nginx container.

The nginx.conf configuration in the container is as follows

server {
  listen 80;
  server_name a.com;
  root /usr/local/nginx/html/a;
  index index.html;
}

server {
  listen 80;
  server_name b.com;
  root /usr/local/nginx/html/b;
  index index.html;
}
为情所困为情所困2741 days ago1129

reply all(1)I'll reply

  • 世界只因有你

    世界只因有你2017-05-24 11:37:51

    You only need to set up the host machine

    reply
    0
  • Cancelreply