Nginx Proxy Docker Compose Examples
Simple
cd simple
docker compose up
curl -H Host:whoami.local localhost
Example output:
I'm 1ca17e445895
Multiple Hosts
cd multiple-hosts
docker compose up
curl -H Host:whoami.local localhost
curl 127.0.0.1.sslip.io
Basic Authentication
Place htpasswd file as $VIRTUAL_HOST
.
cd basic-auth
echo "user:$(openssl passwd -apr1 pass)" > whoami.local
docker compose up
curl -H Host:whoami.local -u user:pass localhost
SSL using ACME CA
Requirements the following:
- allow access to port 80 from internet
- required for HTTP authentication when issuing certificates
- own a domain
- if you do not own the domain, you can use sslip.io.
cd ssl
echo "HOST=$YOUR_DOMAIN" > .env
# when using sslip
echo "HOST=$YOUR_IP.sslip.io" > .env
docker compose up