I was just doing a major redeployment when I realized I’ve never documented my approach to nginx-proxy and lets-encrypt with Version 3 of docker-compose.
I like to deploy a bunch of web applications and static web sites behind a single proxy. What follows is meant to be copy-paste workable on an Ubuntu 16.04 server.
Organization
Set up your server’s directory structure:
1
mkdir -p ~/sites/nginx-proxy && cd ~/sites/nginx-proxy
# Do not forget to 'docker network create nginx-proxy' before launch
# and to add '--network nginx-proxy' to proxyed containers.
networks:
default:
external:
name: nginx-proxy
Configuring the nginx in nginx-proxy
Sometimes you need to override the default nginx configuration contained in the nginx-proxy Docker image. To do this, you must build a new image using nginx-proxy as its base.
For example, an app might need to accept large file uploads. You would paste this into your Dockerfile: