Skip to content

Instantly share code, notes, and snippets.

@trivoallan
Last active May 23, 2018 10:29
Show Gist options
  • Save trivoallan/d2caea6b9909af15788bcf7d98de0bfd to your computer and use it in GitHub Desktop.
Save trivoallan/d2caea6b9909af15788bcf7d98de0bfd to your computer and use it in GitHub Desktop.
OAuth protected static website
version: '3'
services:
# Description of Containers:
#
# authproxy This is the oauth2_proxy container
# nginx-static This is the upstream app that is protected by the oauth2_proxy
# nginx-ssl-proxy This server performs the SSL termination. SSL certificates are managed automatically using Letsencrypt
authproxy:
image: a5huynh/oauth2_proxy
command: --cookie-secure=false --upstream="http://nginx-static:80" --http-address="0.0.0.0:4180" --redirect-url="https://<domain>/oauth2/callback" --provider=github --github-org="<myorg>" --email-domain=*
environment:
OAUTH2_PROXY_COOKIE_SECRET:
OAUTH2_PROXY_COOKIE_DOMAIN: <domain>
OAUTH2_PROXY_CLIENT_ID:
OAUTH2_PROXY_CLIENT_SECRET:
nginx-static:
image: nginx:stable-alpine
depends_on:
- authproxy
volumes:
- ./html:/usr/share/nginx/html
- ./nginx.conf:/etc/nginx/conf.d/default.conf
nginx-ssl-proxy:
image: danieldent/nginx-ssl-proxy
restart: always
environment:
UPSTREAM: authproxy:4180
SERVERNAME: <domain>
ports:
- "80:80"
- "443:443"
volumes:
- "/etc/letsencrypt"
depends_on:
- authproxy
# vim: sw=2 sts=2 et
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment