Nginx Reverse Proxy Docker Image
This image use variable "SYSTEM" to define the server name for each application behind the proxy. Ex.:
-e SYSTEM=glpi \
-e SYSTEM1=ocsinventory \
-e SYSTEM2=wordpress
and DOMAIN variable to match with domain url of applications (don't forget start domain with a dot):
-e DOMAIN=.mydomain.com
These environment variable will be used to create config file with FQDN of each application behind the proxy. Ex. Using the above examples, three config files will be created in /etc/nginx/conf.d/ path: glpi.mydomain.com.conf, ocsinventory.mydomain.com.conf and wordpress.mydomain.com.conf and three log file will be created in /var/log/nginx/ path: glpi.mydomain.com.log, ocsinventory.mydomain.com.log and wordpress.mydomain.com.log.
Before starting the reverse proxy container you should have already created the application containers. The value of SYSTEM variable must be match with the name of applications containers (--name), and all of these containers must be part of the same network. To create container that work like reverse proxy for three applications (e.g. glpi, ocsinventory and wordpress), you must first create these applications containers on the same network (like mynetwork, for example).
So, create the reverse-proxy container with follow command:
# docker run -d -p 80:80 -e SYSTEM=glpi -e SYSTEM1=ocsinventory -e SYSTEM2=wordpress -e DOMAIN=mydomain.com --name reverse-proxy --network mynetwork cmotta2016/reverse-proxy
Now you might access your applications through FQDN, if you have created a DNS registry.
To create yours own config files, do you need export the nginx config dir on container to your host:
# docker run -d -p 80:80 -v /some/host/dir:/etc/nginx/conf.d --name reverse-proxy --network mynetwork cmotta2016/reverse-proxy
So, you might create your config file on /some/host/dir/ and restart container.
docker pull cmotta2016/reverse-proxy:latest