Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/teonite/docker-nginx-dynamic-sites
Serve static sites based on their domain using Docker & NGINX
https://github.com/teonite/docker-nginx-dynamic-sites
Last synced: about 2 months ago
JSON representation
Serve static sites based on their domain using Docker & NGINX
- Host: GitHub
- URL: https://github.com/teonite/docker-nginx-dynamic-sites
- Owner: teonite
- License: apache-2.0
- Created: 2015-12-30T08:00:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-26T23:14:36.000Z (over 5 years ago)
- Last Synced: 2024-06-28T05:38:16.053Z (3 months ago)
- Language: Dockerfile
- Homepage:
- Size: 14.6 KB
- Stars: 18
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![TEONITE](http://teonite.com/img/inorbit_by_tnt.png)](http://teonite.com/) Build: [![Circle CI](https://circleci.com/gh/teonite/docker-nginx-dynamic-sites.svg?style=svg)](https://circleci.com/gh/teonite/docker-nginx-dynamic-sites) [![](https://badge.imagelayers.io/teonite/nginx-dynamic-sites:latest.svg)](https://imagelayers.io/?images=teonite/nginx-dynamic-sites:latest 'Get your own badge on imagelayers.io')
docker-nginx-dynamic-sites is a simple solution to have one NGINX docker/container instance for multiple domains (virtual hosts).
The only thing you need to do is:
1. Launch the contener
2. Set all domain names to the IP that the container is exposed
3. Put all your sites to /sites/ (volume exposed) directory with the domain names.### How does it work?
1. detects and "creates" a virtual host based on the requested URL domain
2. tries to find a folder with the domain name in the `/sites/` directory (eg. `/sites/domainname.com`)
3. If the folder exists, site is served - if not, the default one is served (`/sites/default`)We've created this simple solution, as our whole infrastructure runs on Docker - and we wanted to have only one NGINX instance for all static sites.
### Usage
To run it:
$ docker run -d -p 80:80 -v /path/to/sites:/sites/ teonite/nginx-dynamic-sites
### Log files
There is only one error log file (`/var/log/nginx/error.log`). Access logs are created with domain name eg. `/var/log/nginx/domainname.com.access.log`.