> ## Documentation Index
> Fetch the complete documentation index at: https://docs.levelrail.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Self-host OAuth2 Proxy with Docker

> Reverse proxy that puts an OAuth2 or OIDC login in front of any upstream. The install form carries oauth2-proxy.cfg as an editable file with a generated cookie secret, so it starts without extra flags.

Reverse proxy that puts an OAuth2 or OIDC login in front of any upstream. The install form carries oauth2-proxy.cfg as an editable file with a generated cookie secret, so it starts without extra flags.

This page describes the Levelrail template for OAuth2 Proxy (Security). It deploys the services below as one Docker Compose app on your own server. Project site: [https://oauth2-proxy.github.io/oauth2-proxy/](https://oauth2-proxy.github.io/oauth2-proxy/).

Recommended memory: about 64 MiB.

## Services, ports and volumes

| Service | Image | Container ports | Volumes |
| - | - | - | - |
| `oauth2-proxy` | `quay.io/oauth2-proxy/oauth2-proxy:v7.15.6` | 4180 | none |

## Environment variables

This template sets no environment variables.

Passwords and keys marked as generated are created for you when the app is deployed and stored as secrets. Values are not shown here.

## Security and requirements

Level: **Standard**.

What this template needs:

* No health check, so a deploy is judged by the process starting (`oauth2-proxy`).

What Levelrail adds around it:

* Automatic HTTPS and an ingress shield in front of every domain.
* One-step rollback to the previous revision.
* Exposure report shows what is reachable from outside.
* Host firewall rules managed for published ports.

## Deploy OAuth2 Proxy with Levelrail

In the dashboard, open **Apps**, choose **New app**, then **Browse templates**, and select OAuth2 Proxy. Review the Compose body and deploy.

With the CLI:

```bash theme={"dark"}
levelrail-cli templates deploy oauth2-proxy --name my-oauth2-proxy
```

See the [service template catalog](https://docs.levelrail.com/templates-and-registry.md) for how templates work, and [Getting started](https://docs.levelrail.com/getting-started.md) if you have not installed Levelrail yet.

## More Security templates

* [2FAuth](https://docs.levelrail.com/self-host/2fauth.md)
* [Anubis](https://docs.levelrail.com/self-host/anubis.md)
* [Authelia](https://docs.levelrail.com/self-host/authelia.md)
* [authentik](https://docs.levelrail.com/self-host/authentik.md)
* [Cap](https://docs.levelrail.com/self-host/cap-captcha.md)

All templates are listed in the [self-host gallery](https://docs.levelrail.com/self-host.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.