A simple reverse-proxy under nginx for docker. It use the Let's Encrypt client and ACME library lego written in Go for creation of certificates. More, you can setup cron job to renew certificates for all your site behind your reverse-proxy.
pfillion/reverse-proxy:latest at Docker HubThe reverse-proxy support one environnement variables.
LEGO_MODE definde how lego will interact with Let's Encrypt for ACME challenge. The value possible is staging (default) and normal. For testing, it recommender to use the staging api.
You can mount directly a file or use docker configuration to schedule all job like a crontab file. See the example below.
[
{
"schedule": "0 0 0 */2 *",
"command": "lego.sh",
"args": [
"www.example.com",
"[email protected]"
]
},
{
"schedule": "0 0 0 */2 *",
"command": "lego.sh",
"args": [
"another.example.com",
"[email protected]"
]
},
...
]
This config will schedule cron job for renew certificate and copy them in the /.lego folder by default. All yopu have to do is configure you nginx proxy to use them.
server {
listen 443 ssl;
http2 on;
server_name www.example.com;
ssl_certificate /.lego/certificates/www.example.com.crt;
ssl_certificate_key /.lego/certificates/www.example.com.key;
...
}
See the docker swarm in the source code or below.
version: '3.7'
services:
nginx-proxy:
image: pfillion/reverse-proxy:latest
environment:
LEGO_MODE: 'staging'
networks:
- reverse_proxy_network
ports:
- 80:80
- 443:443
volumes:
- nginx_volume:/etc/nginx
- cron_configs_volume:/configs
networks:
reverse_proxy_network:
driver: overlay
volumes:
nginx_volume:
...
cron_configs_volume:
...
MIT
Content type
Image
Digest
sha256:043cb777b…
Size
68.1 MB
Last updated
10 months ago
docker pull pfillion/reverse-proxy