https://github.com/waltertamboer/experiment-docker-nginx-proxy
This repository contains an experiment where I set up two sites within Docker containers and nginx acts as a proxy.
https://github.com/waltertamboer/experiment-docker-nginx-proxy
apache docker docker-compose httpd nginx proxy
Last synced: about 2 months ago
JSON representation
This repository contains an experiment where I set up two sites within Docker containers and nginx acts as a proxy.
- Host: GitHub
- URL: https://github.com/waltertamboer/experiment-docker-nginx-proxy
- Owner: waltertamboer
- License: mit
- Created: 2019-10-08T08:18:43.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-08T08:49:59.000Z (over 6 years ago)
- Last Synced: 2025-01-19T19:49:37.153Z (over 1 year ago)
- Topics: apache, docker, docker-compose, httpd, nginx, proxy
- Language: HTML
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# experiment-docker-nginx-proxy
This repository contains an experiment where I set up two sites within Docker containers and
nginx acts as a proxy.
## The Problem
Consider running multiple webserver containers on the same server. How does the server know
which container to serve to the user?
## Solution
This project contains a `docker-compose.yml` file containing three containers. Two websites
that serve a webpage via Apache httpd: "Site 1" and "Site 2". The third container is an nginx
container acting as a proxy between the two sites.
Within the nginx configuration two sites are defined with two different server names:
- site1.experiment.waltertamboer.nl
- site2.experiment.waltertamboer.nl
Each container runs on a different port (8081 and 8082 in this example). When one of these
addresses is entered in the browser, the proxy knows to which container the user should be
redirected.
## Installation
- Clone the repository
- Edit your `/etc/hosts` file and make sure it contains the following lines:
```
127.0.0.1 site1.experiment.waltertamboer.nl
127.0.0.1 site2.experiment.waltertamboer.nl
```
- Start up the containers: `docker-compose up -d`
Now you'll be able to visit site 1 and site 2 via the following addresses:
- http://site1.experiment.waltertamboer.nl
- http://site2.experiment.waltertamboer.nl