timothyde / aws-reverse-proxy

My personal reverse proxy config for use on Amazon Linux 2 AMI using traefik

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reverse Proxy Configuration with Traefik

This is a step by step guide on how to run a reverse proxy with Traefik

Getting Started

These instructions are meant to be used on an AWS Linux EC2 Instance. The necessary commands may vary depending on your use case.

Prerequisites

First and foremost, you need a server which you can SSH into. Since we are using the Traefik Docker Container, we need to install Docker first. Use this guide if you need assistance.

Next up, we need docker-compose. Use this gist if you need assistance.

To create a password for the Traefik admin tools, we are gonna use htpasswd, which can be installed via

sudo yum install httpd-tools

Installing

First up, create a password for your admin user with the following command, replacing <your_secure_password> with your password and save the output for later.

htpasswd -nb admin <your_secure_password>

Output
admin:$apr1$ruca84Hq$mbjdMZBAG.KWn7vfN/SNK/

Use the above output and replace <your_encrypted_password> with the newly encrypted password in the line

  users = ["admin:<your_encrypted_password>"]

inside of traefik.toml. Also inside of traefik.toml, replace the email with yours:

  email = "<your_email>"

Inside of docker-compose.yaml, replace the traefik.frontend.rule label with your domain

    labels:
      ...
      - "traefik.frontend.rule=Host:monitor.<your_domain>"
      ...

Deployment

Important: The line

caServer = "https://acme-staging.api.letsencrypt.org/directory"

in traefik.toml creates a fake tls certificate, which should not be used in production. This line is used for staging and testing to prevent exceeding rate limits on Let's Encrypt. Only comment it out if you are done playing around with the settings.

Use the docker-compose.yml to run the container, e.g. with -d flag for detached

docker-compose -f docker-compose.yml up -d

Built With

  • traefik - used as a reverse proxy

Authors

License

This project is licensed under the MIT License.

Acknowledgments

About

My personal reverse proxy config for use on Amazon Linux 2 AMI using traefik