Skip to content

Configuration to make simple reverse proxy (with HTTPS support) with nginx and docker

Notifications You must be signed in to change notification settings

samaranin/nginx-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Nginx reverse proxy

Simple docker + nginx configuration to make reverse proxy with HTTPS support

How to use

1. Place docker-compose.yml and nginx.tmpl in one folder.
2. Create external network nginx-proxy

$ docker network create nginx-proxy

3. And start service with

$ docker-compose up -d

4. Then start service container(s).

IMPORTANT: Proxy containers and service containers must be in common external network (nginx-proxy in example).


Example of docker-compose file for service

version: '3'

services:
  flask:
    container_name: flask
    restart: always
    build:
      context: .
      dockerfile: Dockerfile-flask
    networks:
      - nginx-proxy
    environment:
      - VIRTUAL_HOST=domain.com,www.domain.com
      - LETSENCRYPT_HOST=domain.com
      - [email protected]
      - VIRTUAL_PORT=5000
    volumes:
      - "./:/app"
    entrypoint: /flask-entrypoint.sh
    expose:
      - 5000

networks:
  default:
    external:
      name: nginx-proxy

List of environment parameters:

  • VIRTUAL_HOST=domain.com,www.domain.com - your domain (add www alias if you need to)

  • VIRTUAL_PORT=5000 - port of your service (must be exposed)

  • LETSENCRYPT_HOST=domain.com - host to generate LetsEncrypt sertificate (matches your domain)

  • [email protected] - email to generate LetsEncrypt sertificate


Source

Repository was based on this article by François Romain.

About

Configuration to make simple reverse proxy (with HTTPS support) with nginx and docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published