Deployment guide

Centralizing authentication with Authentik on VPS

Deploy on a VPS Cloud →

Tutorial

Centralizing authentication with Authentik on VPS

Security & Monitoring3 min read6 steps

Managing one password per application doesn't scale for an agency or a serious homelab. Authentik is an open source identity provider that centralizes SSO, MFA and user management. Deployed on your VPS, it becomes the single authentication point for your entire self-hosted ecosystem.

Contents· Why centralize authentication on your VPS1/4
  1. 01Why centralize authentication on your VPS
  2. 02What you gain with Authentik
  3. 03Requirements for this deployment
  4. 04Deploy Authentik with Docker Compose

Why centralize authentication on your VPS

When you accumulate self-hosted tools (Grafana, Nextcloud, Gitea, an internal dashboard), each brings its own user base and its own password policy. It's a nightmare to maintain and a multiplied attack surface. Authentik solves this by acting as an identity provider (IdP): it supports OAuth2/OIDC, SAML, LDAP and above all forward auth, which lets you protect any application behind a reverse proxy, even those with no notion of login at all. Self-hosting on a VPS guarantees that your credentials never pass through a third-party service and that you remain in control of the user tree and the MFA policies.

What you gain with Authentik

  • A single set of credentials for all your applications, with centralized logout.
  • MFA (TOTP, WebAuthn/FIDO2 keys, backup codes) applied uniformly by policy.
  • Forward auth to protect "login-less" apps, impossible with a classic IdP.
  • Fully customizable flows (registration, recovery, captcha, access conditions).
  • OAuth2/OIDC, SAML and LDAP connectors to plug in both modern and legacy apps.
  • Immediate access provisioning and revocation when a collaborator leaves.

Requirements for this deployment

Authentik is more demanding than a simple service: the stack includes the server, a worker, PostgreSQL and Redis. Count on a VPS with at least 2 vCPU and 4 GB of RAM for comfortable operation, 2 GB being a strict minimum that can struggle under load. Docker and Docker Compose are required, as well as a dedicated domain name (auth.mydomain.com) with an A record. A reverse proxy (Traefik, Nginx Proxy Manager or Caddy) is indispensable to handle SSL and forward auth to your other applications.

Deploy Authentik with Docker Compose

  1. Get the official compose file and generate the secrets

    Download Authentik's reference docker-compose.yml. Generate the sensitive values in a .env file: PG_PASS and AUTHENTIK_SECRET_KEY via openssl rand -base64 60. Never reuse an example key.

  2. Start the stack

    Run docker compose up -d. Four containers come up: server, worker, postgresql and redis. Monitor the initialization with docker compose logs -f server until you see the server ready to listen.

  3. Finalize the installation via /if/flow/initial-setup/

    On first launch, go to https://auth.mydomain.com/if/flow/initial-setup/ to set the password for the akadmin account. This is your super-administrator: protect it immediately with MFA.

  4. Configure the reverse proxy and SSL

    Route auth.mydomain.com to port 9000 (HTTP) or 9443 (HTTPS) of the server container via your reverse proxy, with a Let's Encrypt certificate. Authentik absolutely must be served over HTTPS for session cookies and WebAuthn to work.

  5. Create a provider and an application

    In the admin, create a Provider (OIDC for a modern app, or Proxy for forward auth) then the associated Application. For OIDC, retrieve the client_id / client_secret and the .well-known/openid-configuration URL to paste into the client app.

  6. Protect an app with forward auth

    For an application without native login, create a Proxy Provider and declare an authentication middleware in your reverse proxy pointing to the /outpost.goauthentik.io/auth/ endpoint. Any unauthenticated request is then redirected to Authentik before reaching the app.

Enable an integrated Outpost and leverage "property mappings" to inject headers (X-authentik-username, X-authentik-groups) into your forward auth applications: many apps (Grafana, for example) can read these headers to do user auto-provisioning and role assignment. You thus get not only SSO, but also a fully automated group-to-role mapping, without manual configuration in each tool.

Centralize your access on your own VPS

The ServOrbit Cloud VPS with a preconfigured Docker template offers the RAM and storage needed for the Authentik stack (server, worker, PostgreSQL, Redis) ready to receive your applications.

Need help?

Browse our help center and FAQ, or reach our team — callback, WhatsApp or email. Support in French, English and Arabic.

Message us on WhatsAppopens in a new tab