Skip to content

A Reverse Proxy Solution with Automatic Nginx Config Generation and Let’s Encrypt SSL Certificate Management

Notifications You must be signed in to change notification settings

jn-s3s/docker-reverse-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reverse Proxy

Credits to @olexs

nginx-proxy

Sets up a container running nginx and docker-gen (previously created separately). docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped.

acme-companion (Let's Encrypt SSL Companion)

acme-companion is a lightweight companion container for nginx-proxy.

It handles the automated creation, renewal and use of SSL certificates for proxied Docker containers through the ACME protocol.

How to use (after cloning this repo)

1. Create the docker network

docker network create reverse-proxy

2. Run docker compose command to create nginx-proxy and acme-companion containers

docker-compose up -d

3. (Optional) To check logs, run docker exec command

  • nginx-proxy
    docker logs -f nginx-proxy
    
  • acme-companion
    docker logs -f acme-companion
    

Expose Port (nginx-proxy)

  • 80
  • 443
  • IPV6 support ready

Testing

1. On your website directory, create docker.compose.yml

services:
  test-website:
    image: nginx:latest
    container_name: test-website
    restart: always
    environment:
      - LETSENCRYPT_HOST=domain.com # @TODO: your public DNS name
      - VIRTUAL_HOST=domain.com  # @TODO: your public DNS name, the same domain as above
      - VIRTUAL_PORT=80 # @TODO: port used
    networks:
      - reverse-proxy # the same network of nginx-proxy and acme-companion

networks:
  reverse-proxy:
    external: true

2. Run docker-compose to create test-website container

docker-compose up -d

3. Wait up till 5 minutes, then visit your domain

The created test-website should automatically have SSL certificate and it's own nginx server configurations

References

About

A Reverse Proxy Solution with Automatic Nginx Config Generation and Let’s Encrypt SSL Certificate Management

Topics

Resources

Stars

Watchers

Forks