Attempt to configure the Dockers official Nginx image nginx.conf configuration failed, it is very little known about the basic Search tutorial.
Here's the process I tried:
Yba
docker run -d --name YBa --restart=always -v /Storage/Volumes/App/YBa:/usr/src/myapp php
YBb
docker run -d --name YBa --restart=always -v /Storage/Volumes/App/YBb:/usr/src/myapp php
Nginx
docker run -d -p 80:80 --name Nginx --link YBa:yba --link YBb:ybb -v /Storage/Volumes/Services/Nginx/Conf/nginx.conf/nginx.conf:/etc/nginx/nginx.conf:ro --restart=always nginx
Nginx.conf
user nobody nogroup;events { worker_connections 512; }http { upstream yba { server yba; } upstream ybb { server ybb; } server { listen *:80; server_name http://app1.com; location / { proxy_pass http://yba/; proxy_set_header X-Real_IP $remote_addr; proxy_set_header Host $http_host; } }} server { listen *:80; server_name http://app2.com; location / { proxy_pass http://ybb/; proxy_set_header X-Real_IP $remote_addr; proxy_set_header Host $http_host; } }}
The question now is how to complete multiple domains with multiple containers through a single configuration file
Want to know if there's any other way around
How to point to multiple primary domain names for different subdirectories of a single container
Reply content:
Attempt to configure the Dockers official Nginx image nginx.conf configuration failed, it is very little known about the basic Search tutorial.
Here's the process I tried:
Yba
docker run -d --name YBa --restart=always -v /Storage/Volumes/App/YBa:/usr/src/myapp php
YBb
docker run -d --name YBa --restart=always -v /Storage/Volumes/App/YBb:/usr/src/myapp php
Nginx
docker run -d -p 80:80 --name Nginx --link YBa:yba --link YBb:ybb -v /Storage/Volumes/Services/Nginx/Conf/nginx.conf/nginx.conf:/etc/nginx/nginx.conf:ro --restart=always nginx
Nginx.conf
user nobody nogroup;events { worker_connections 512; }http { upstream yba { server yba; } upstream ybb { server ybb; } server { listen *:80; server_name http://app1.com; location / { proxy_pass http://yba/; proxy_set_header X-Real_IP $remote_addr; proxy_set_header Host $http_host; } }} server { listen *:80; server_name http://app2.com; location / { proxy_pass http://ybb/; proxy_set_header X-Real_IP $remote_addr; proxy_set_header Host $http_host; } }}
The question now is how to complete multiple domains with multiple containers through a single configuration file
Want to know if there's any other way around
How to point to multiple primary domain names for different subdirectories of a single container
The corresponding configuration file can be configured locally on conf/, example conf/api.app2.com.conf, when the container is created, add the Dockerfile code as follows
From nginx:1.9MAINTAINER terry.dawu@gmail.comADD nginx.conf /etc/nginx/nginx.confADD conf/* /etc/nginx/conf.d/RUN mkdir /opt/www && mkdir /opt/logRUN chmod -R 755 /opt/log /opt/wwwVOLUME ["/opt"]
Nginx proxy distribution, pointing to different ports on this machine
CDN distribution, pointing to different ports on the server