A docker image of reverse proxy.
| environment | default | required | description |
|---|---|---|---|
RENEW_SCHED | 0 0 1 * * | no | schedule of certificates renewal attempts |
DOMAINS | | no | domains and their routings |
STAGE | local | no | stage to deploy |
CLIENT_MAX_BODY_SIZE | 1m | no | client_max_body_size |
RENEW_SCHED is specified as a cron expression. See https://crontab.guru.DOMAINS is specified as a , separated sequence, each element of which is represented as domain or domain -> URL.
domain, the container obtains and renews the certificate of the domain.domain -> URL, in addition to the above, the container routes requests with the domain to the specified URL.STAGE is specified as one of local, staging or production.
local is specified, the container obtains and renews self-signed certificates.staging is specified, the container obtains and renews Let's Encrypt certificates for testing.production is specified, the container obtains and renews Let's Encrypt certificates for publishing.CLIENT_MAX_BODY_SIZE: See client_max_body_size at http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size/certificates/Obtained certificates are placed at /certificates/STAGE/domain/ in the container.
docker-compose up --build -d
docker-compose.yml.
version: '3'
services:
reverse_proxy:
container_name: 'reverse_proxy'
image: 'jumpaku/nginx-letsencrypt-reverse-proxy'
ports:
- '80:80'
- '443:443'
environment:
- "RENEW_SCHED="
- "STAGE=local"
#- "STAGE=staging"
#- "STAGE=production"
- "DOMAINS=sub0.example.com, sub1.example.com -> http://othello:8080"
volumes:
- "./certificates:/certificates"
othello:
container_name: 'othello'
image: 'jumpaku/jumpaku-othello'
reverse_proxy.
docker-compose exec reverse_proxy bash
curl http://localhost
# => fails
curl -k https://localhost
# => fails
curl -H 'Host: sub0.example.com' http://localhost
# => 301
curl -k -H 'Host: sub0.example.com' https://localhost
# => 204
curl -H 'Host: sub1.example.com' http://localhost
# => 301
curl -k -H 'Host: sub1.example.com' https://localhost
# => 200
./certificates/ in host machine.Content type
Image
Digest
Size
85.6 MB
Last updated
about 6 years ago
docker pull jumpaku/nginx-letsencrypt-reverse-proxy