2016-12-17 18:36:41 +00:00
|
|
|
worker_processes 1;
|
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
|
|
|
server {
|
2017-01-21 16:41:06 +00:00
|
|
|
listen 443 ssl;
|
2017-11-02 20:34:07 +00:00
|
|
|
server_name login.example.com;
|
|
|
|
|
|
|
|
resolver 127.0.0.11 ipv6=off;
|
|
|
|
set $upstream_endpoint http://nginx-authelia;
|
2017-01-21 16:41:06 +00:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
2016-12-17 18:36:41 +00:00
|
|
|
|
2017-10-15 15:18:15 +00:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 16:03:18 +00:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2016-12-17 18:36:41 +00:00
|
|
|
|
2017-05-14 15:34:51 +00:00
|
|
|
location / {
|
2016-12-17 18:36:41 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_intercept_errors on;
|
|
|
|
|
|
|
|
proxy_pass $upstream_endpoint;
|
|
|
|
|
|
|
|
if ($request_method !~ ^(POST)$){
|
|
|
|
error_page 401 = /error/401;
|
|
|
|
error_page 403 = /error/403;
|
|
|
|
error_page 404 = /error/404;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
listen 443 ssl;
|
|
|
|
server_name home.example.com;
|
|
|
|
|
|
|
|
resolver 127.0.0.11 ipv6=off;
|
|
|
|
set $upstream_endpoint http://nginx-backend;
|
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
|
|
|
|
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2017-01-27 00:20:03 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
location / {
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_pass $upstream_endpoint;
|
2016-12-17 18:36:41 +00:00
|
|
|
}
|
2017-03-15 22:07:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2017-11-01 23:37:10 +00:00
|
|
|
listen 443 ssl;
|
2017-11-02 20:34:07 +00:00
|
|
|
server_name public.example.com;
|
|
|
|
|
|
|
|
resolver 127.0.0.11 ipv6=off;
|
|
|
|
set $upstream_verify http://nginx-authelia/api/verify;
|
|
|
|
set $upstream_endpoint http://nginx-backend;
|
|
|
|
set $upstream_headers http://httpbin:8000/headers;
|
2017-09-03 13:22:09 +00:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
|
|
|
|
2017-10-15 15:18:15 +00:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 16:03:18 +00:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2017-10-15 15:18:15 +00:00
|
|
|
|
2017-09-03 13:22:09 +00:00
|
|
|
location /auth_verify {
|
|
|
|
internal;
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2017-09-03 13:22:09 +00:00
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2017-10-15 14:34:39 +00:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2017-10-14 13:04:43 +00:00
|
|
|
proxy_set_header Content-Length "";
|
2017-09-03 13:22:09 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_verify;
|
2017-09-03 13:22:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
auth_request /auth_verify;
|
|
|
|
|
2017-10-14 13:04:43 +00:00
|
|
|
auth_request_set $redirect $upstream_http_redirect;
|
|
|
|
|
2017-09-03 13:22:09 +00:00
|
|
|
auth_request_set $user $upstream_http_remote_user;
|
|
|
|
proxy_set_header X-Forwarded-User $user;
|
|
|
|
|
|
|
|
auth_request_set $groups $upstream_http_remote_groups;
|
|
|
|
proxy_set_header Remote-Groups $groups;
|
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-01 23:37:10 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-01 23:37:10 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_endpoint;
|
2017-09-03 13:22:09 +00:00
|
|
|
}
|
2017-10-14 13:04:43 +00:00
|
|
|
|
|
|
|
location /headers {
|
|
|
|
auth_request /auth_verify;
|
|
|
|
|
|
|
|
auth_request_set $redirect $upstream_http_redirect;
|
|
|
|
|
|
|
|
auth_request_set $user $upstream_http_remote_user;
|
|
|
|
proxy_set_header Custom-Forwarded-User $user;
|
|
|
|
|
|
|
|
auth_request_set $groups $upstream_http_remote_groups;
|
|
|
|
proxy_set_header Custom-Forwarded-Groups $groups;
|
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-01 23:37:10 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_headers;
|
2017-11-01 18:23:45 +00:00
|
|
|
}
|
2017-09-03 13:22:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2017-11-01 23:37:10 +00:00
|
|
|
listen 443 ssl;
|
2017-11-02 20:34:07 +00:00
|
|
|
server_name admin.example.com;
|
|
|
|
|
|
|
|
resolver 127.0.0.11 ipv6=off;
|
|
|
|
set $upstream_verify http://nginx-authelia/api/verify;
|
|
|
|
set $upstream_endpoint http://nginx-backend;
|
2017-09-03 13:22:09 +00:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
|
|
|
|
2017-10-15 15:18:15 +00:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 16:03:18 +00:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2017-10-15 15:18:15 +00:00
|
|
|
|
2017-09-03 13:22:09 +00:00
|
|
|
location /auth_verify {
|
|
|
|
internal;
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2017-09-03 13:22:09 +00:00
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2017-10-15 14:34:39 +00:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2017-10-14 13:04:43 +00:00
|
|
|
proxy_set_header Content-Length "";
|
2017-09-03 13:22:09 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_verify;
|
2017-09-03 13:22:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
auth_request /auth_verify;
|
2017-10-14 13:04:43 +00:00
|
|
|
|
2017-09-03 13:22:09 +00:00
|
|
|
auth_request_set $redirect $upstream_http_redirect;
|
|
|
|
|
|
|
|
auth_request_set $user $upstream_http_remote_user;
|
|
|
|
proxy_set_header X-Forwarded-User $user;
|
|
|
|
|
|
|
|
auth_request_set $groups $upstream_http_remote_groups;
|
|
|
|
proxy_set_header Remote-Groups $groups;
|
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-01 23:37:10 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-01 23:37:10 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_endpoint;
|
2017-09-03 13:22:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2017-11-01 23:37:10 +00:00
|
|
|
listen 443 ssl;
|
2017-11-02 20:34:07 +00:00
|
|
|
server_name dev.example.com;
|
|
|
|
|
|
|
|
resolver 127.0.0.11 ipv6=off;
|
|
|
|
set $upstream_verify http://nginx-authelia/api/verify;
|
|
|
|
set $upstream_endpoint http://nginx-backend;
|
2017-09-03 13:22:09 +00:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
|
|
|
|
2017-10-15 15:18:15 +00:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 16:03:18 +00:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2017-10-15 15:18:15 +00:00
|
|
|
|
2017-09-03 13:22:09 +00:00
|
|
|
location /auth_verify {
|
|
|
|
internal;
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2017-09-03 13:22:09 +00:00
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2017-10-15 14:34:39 +00:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2017-10-14 13:04:43 +00:00
|
|
|
proxy_set_header Content-Length "";
|
2017-09-03 13:22:09 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_verify;
|
2017-09-03 13:22:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
auth_request /auth_verify;
|
2017-10-14 13:04:43 +00:00
|
|
|
|
2017-09-03 13:22:09 +00:00
|
|
|
auth_request_set $redirect $upstream_http_redirect;
|
|
|
|
|
|
|
|
auth_request_set $user $upstream_http_remote_user;
|
|
|
|
proxy_set_header X-Forwarded-User $user;
|
|
|
|
|
|
|
|
auth_request_set $groups $upstream_http_remote_groups;
|
|
|
|
proxy_set_header Remote-Groups $groups;
|
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-01 23:37:10 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-01 23:37:10 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_endpoint;
|
2017-09-03 13:22:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2017-11-01 23:37:10 +00:00
|
|
|
listen 443 ssl;
|
2017-11-02 20:34:07 +00:00
|
|
|
server_name mx1.mail.example.com mx2.mail.example.com;
|
|
|
|
|
|
|
|
resolver 127.0.0.11 ipv6=off;
|
|
|
|
set $upstream_verify http://nginx-authelia/api/verify;
|
|
|
|
set $upstream_endpoint http://nginx-backend;
|
2017-03-15 22:07:57 +00:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
|
|
|
|
2017-10-15 15:18:15 +00:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 16:03:18 +00:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2017-10-15 15:18:15 +00:00
|
|
|
|
2017-05-14 15:34:51 +00:00
|
|
|
location /auth_verify {
|
|
|
|
internal;
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2017-03-15 22:07:57 +00:00
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2017-10-15 14:34:39 +00:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2017-09-23 16:02:21 +00:00
|
|
|
proxy_set_header Content-Length "";
|
2017-03-15 22:07:57 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_verify;
|
2017-03-15 22:07:57 +00:00
|
|
|
}
|
2016-12-17 18:36:41 +00:00
|
|
|
|
2017-09-03 13:22:09 +00:00
|
|
|
location / {
|
2017-05-14 15:34:51 +00:00
|
|
|
auth_request /auth_verify;
|
2017-10-14 13:04:43 +00:00
|
|
|
|
2017-09-22 15:53:18 +00:00
|
|
|
auth_request_set $redirect $upstream_http_redirect;
|
|
|
|
|
2017-09-22 19:18:38 +00:00
|
|
|
auth_request_set $user $upstream_http_remote_user;
|
2016-12-17 18:36:41 +00:00
|
|
|
proxy_set_header X-Forwarded-User $user;
|
2017-09-22 15:53:18 +00:00
|
|
|
|
2016-12-17 18:36:41 +00:00
|
|
|
auth_request_set $groups $upstream_http_remote_groups;
|
|
|
|
proxy_set_header Remote-Groups $groups;
|
2017-09-22 15:53:18 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-01 23:37:10 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-01 23:37:10 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_endpoint;
|
2016-12-17 18:36:41 +00:00
|
|
|
}
|
|
|
|
}
|
2017-09-24 21:19:03 +00:00
|
|
|
|
|
|
|
server {
|
|
|
|
listen 443 ssl;
|
2017-11-02 20:34:07 +00:00
|
|
|
server_name single_factor.example.com;
|
|
|
|
|
|
|
|
resolver 127.0.0.11 ipv6=off;
|
|
|
|
set $upstream_verify http://nginx-authelia/api/verify;
|
|
|
|
set $upstream_endpoint http://nginx-backend;
|
|
|
|
set $upstream_headers http://httpbin:8000/headers;
|
2017-09-24 21:19:03 +00:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
|
|
|
|
2017-10-15 15:18:15 +00:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 16:03:18 +00:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2017-10-15 15:18:15 +00:00
|
|
|
|
2017-09-24 21:19:03 +00:00
|
|
|
location /auth_verify {
|
|
|
|
internal;
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2017-09-24 21:19:03 +00:00
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2017-10-15 14:34:39 +00:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2017-09-24 21:19:03 +00:00
|
|
|
proxy_set_header Content-Length "";
|
2017-11-01 18:23:45 +00:00
|
|
|
proxy_set_header Proxy-Authorization $http_authorization;
|
2017-09-24 21:19:03 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_verify;
|
2017-09-24 21:19:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
auth_request /auth_verify;
|
2017-10-14 13:04:43 +00:00
|
|
|
|
2017-09-24 21:19:03 +00:00
|
|
|
auth_request_set $redirect $upstream_http_redirect;
|
|
|
|
|
|
|
|
auth_request_set $user $upstream_http_remote_user;
|
|
|
|
proxy_set_header X-Forwarded-User $user;
|
|
|
|
|
|
|
|
auth_request_set $groups $upstream_http_remote_groups;
|
|
|
|
proxy_set_header Remote-Groups $groups;
|
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-01 23:37:10 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-01 23:37:10 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_endpoint;
|
2017-09-24 21:19:03 +00:00
|
|
|
}
|
2017-11-01 18:23:45 +00:00
|
|
|
|
|
|
|
location /headers {
|
|
|
|
auth_request /auth_verify;
|
|
|
|
|
|
|
|
auth_request_set $redirect $upstream_http_redirect;
|
|
|
|
|
|
|
|
auth_request_set $user $upstream_http_remote_user;
|
|
|
|
proxy_set_header Custom-Forwarded-User $user;
|
|
|
|
|
|
|
|
auth_request_set $groups $upstream_http_remote_groups;
|
|
|
|
proxy_set_header Custom-Forwarded-Groups $groups;
|
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-01 18:23:45 +00:00
|
|
|
|
2017-11-02 20:34:07 +00:00
|
|
|
proxy_pass $upstream_headers;
|
2017-11-01 18:23:45 +00:00
|
|
|
}
|
2017-09-24 21:19:03 +00:00
|
|
|
}
|
2016-12-17 18:36:41 +00:00
|
|
|
}
|
2017-03-15 22:07:57 +00:00
|
|
|
|