jwilder/nginx-proxy: This container provides virtual host routing of requests on port 80/443 to nginx containers registered with their host name.
jwilder/nginx-proxy: Generates certificates for https using LetsEncrypt
-
Install Docker and Docker Compose https://docs.docker.com/get-docker
-
Clone the Docker Web Server
git clone https://github.com/dylangmiles/docker-webserver.git docker-webserver -
Create a .env file in the application directory with the following values
HOSTNAME=<yourhostname> -
Run
./create-local-crt.shto generate .local and localhost self signed certificates intodata/certs. -
Add
data/certs/local.crtanddata/certs/localhost.crtto your locally trusted certificate store
-
Install Docker and Docker Compose https://docs.docker.com/get-docker
-
Clone the Docker Web Server
git clone https://github.com/dylangmiles/docker-webserver.git docker-webserver -
Create a .env file in the application directory with the following values:
export HOSTNAME=<yourhostname>
To override NGINX parameters you can edit my_proxy.conf
docker-compose up -d server
When setting up web applications in other docker compose configurations you can use environment variables to allow the proxy to route requests
# .env file for dependent web application
FQDN=web.myapp.example
EMAIL=admin@myapp.example
# docker-compose.yml file of a dependant web application running on the server
version: '3.4'
services:
...
web:
...
environment:
...
## Variables to which the proxy and server containers use to route to this application based on the host name
- VIRTUAL_HOST=${FQDN}
- LETSENCRYPT_HOST=${FQDN}
- LETSENCRYPT_EMAIL=${EMAIL}
## The containers in this web app must be part of the same network as the proxy and server containers.
networks:
default:
name: internet