docs/content/integration/proxies/nginx-proxy-manager/index.md
NGINX Proxy Manager is supported by Authelia. It's a NGINX proxy with a configuration UI.
Important: When using these guides, it's important to recognize that we cannot provide a guide for every possible method of deploying a proxy. These guides show a suggested setup only, and you need to understand the proxy configuration and customize it to your needs. To-that-end, we include links to the official proxy documentation throughout this documentation and in the See Also section.
It's strongly recommended that users setting up Authelia for the first time take a look at our Get started guide. This takes you through various steps which are essential to bootstrapping Authelia.
NGINX Proxy Manager supports the required NGINX requirements for Authelia out-of-the-box.
Important: You should read the Forwarded Headers section and this section as part of any proxy configuration. Especially if you have never read it before.
To configure trusted proxies for NGINX Proxy Manager see the NGINX section on Trusted Proxies. Adapting this to NGINX Proxy Manager is beyond the scope of this documentation.
This guide makes a few assumptions. These assumptions may require adaptation in more advanced and complex scenarios. We can not reasonably have examples for every advanced configuration option that exists. Some of these values can automatically be replaced with documentation variables.
{{< sitevar-preferences >}}
The following are the assumptions we make:
{{< sitevar name="host" nojs="authelia" >}} on port {{< sitevar name="port" nojs="9091" >}}{{< sitevar name="tls" nojs="http" >}}://{{< sitevar name="host" nojs="authelia" >}}:{{< sitevar name="port" nojs="9091" >}} and as such:
https:// if Authelia configuration has a TLS key and
certificate defined{{< sitevar name="host" nojs="authelia" >}} in the URL if:
{{< sitevar name="port" nojs="9091" >}} in the URL if:
{{< sitevar name="domain" nojs="example.com" >}} domain:
The following docker compose example has various applications suitable for setting up an example environment.
---
networks:
net:
driver: 'bridge'
services:
nginx:
container_name: 'nginx'
image: 'jc21/nginx-proxy-manager'
restart: 'unless-stopped'
networks:
net:
aliases: []
ports:
- '80:80'
- '81:81'
- '443:443'
volumes:
- '${PWD}/data/nginx-proxy-manager/data:/data'
- '${PWD}/data/nginx-proxy-manager/letsencrypt:/etc/letsencrypt'
- '${PWD}/data/nginx/snippets:/snippets'
environment:
TZ: 'Australia/Melbourne'
authelia:
container_name: '{{< sitevar name="host" nojs="authelia" >}}'
image: 'authelia/authelia'
restart: 'unless-stopped'
networks:
net:
aliases: []
volumes:
- '${PWD}/data/authelia/config:/config'
environment:
TZ: 'Australia/Melbourne'
nextcloud:
container_name: 'nextcloud'
image: 'lscr.io/linuxserver/nextcloud'
restart: 'unless-stopped'
networks:
net:
aliases: []
volumes:
- '${PWD}/data/nextcloud/config:/config'
- '${PWD}/data/nextcloud/data:/data'
environment:
PUID: '1000'
PGID: '1000'
TZ: 'Australia/Melbourne'
whoami:
container_name: 'whoami'
image: 'docker.io/traefik/whoami'
restart: 'unless-stopped'
networks:
net:
aliases: []
environment:
TZ: 'Australia/Melbourne'
...
Important: Our examples make assumptions about your configuration. These assumptions represent sections that either most likely require an adjustment, or may require an adjustment if you're not configuring it in the same way.
{{< sitevar name="subdomain-authelia" nojs="auth" >}}.{{< sitevar name="domain" nojs="example.com" >}} which should be adjusted in all examples and snippets to your actual
domain./snippets/ directory.
If you choose a different directory, you're required to adjust every instance of /snippets/ appropriately to your
needs.container_name of authelia or the Authelia process is otherwise resolvable by
NGINX Proxy Manager as authelia.The examples assume you've mounted a volume containing the relevant
NGINX Snippets from the NGINX Integration Guide. The
suggested snippets are the proxy.conf, authelia-location.conf, and authelia-authrequest.conf. It may be fine to
substitute the standard variant of the proxy.conf for the headers only variant but this is untested. You will need websocket.conf if any protected applications require websockets.
These snippets make the addition of a protected proxy host substantially easier.
The Authelia portal requires minimal configuration.
Proxy Host.Details tab:
{{< sitevar name="subdomain-authelia" nojs="auth" >}}.{{< sitevar name="domain" nojs="example.com" >}}httpauthelia9091SSL tab to:
trueAdvanced tab:location / {
include /snippets/proxy.conf;
proxy_pass $forward_scheme://$server:$port;
}
Authelia Portal Details tab example:
{{< picture src="authelia.details.png" alt="Step 2" width="450" >}}
Authelia Portal Advanced tab example:
{{< picture src="authelia.advanced.png" alt="Step 4" width="450" >}}
The following example shows how to configure a protected application. We often use Nextcloud for such examples.
Proxy Host.Details tab:
nextcloud.{{< sitevar name="domain" nojs="example.com" >}}httpnextcloud80SSL tab to:
trueAdvanced tab:include /snippets/authelia-location.conf;
location / {
include /snippets/proxy.conf;
include /snippets/authelia-authrequest.conf;
proxy_pass $forward_scheme://$server:$port;
}
{{< callout context="note" title="Websockets" icon="outline/info-circle" >}}
Note that because we are using the advanced configuration tab, the switches on the Details tab will have no effect. If websockets are required for a protected application, you must include the websocket.conf from the NGINX Snippets.
{{< /callout >}}
Protected Application (Nextcloud) Details tab example:
{{< picture src="nextcloud.details.png" alt="Step 2" width="450" >}}
Protected Application (Nextcloud) Advanced tab example:
{{< picture src="protectedapp.advanced.png" alt="Step 4" width="450" >}}
It's important to note if you define locations in the Custom Locations tab of a proxy host that they will not be
checked with Authelia for authorization effectively bypassing the authorization policies you implement. If you want a
custom location then you can also define this in the advanced tab.
To replicate the Custom Location tab below a location block can be ADDED to the
Protected Application Advanced tab:
location /custom {
include /snippets/proxy.conf;
include /snippets/authelia-authrequest.conf;
proxy_pass http://192.168.1.20:8080;
}
{{< picture src="protectedapp.customlocation.png" alt="Custom Location" width="450" >}}
The following screenshot shows an example of following the directions for the Authelia Portal and two applications:
{{< picture src="proxyhosts.png" alt="Step 4" width="450" >}}