2016-12-18 01:36:41 +07:00
|
|
|
worker_processes 1;
|
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
|
|
|
server {
|
2017-01-21 23:41:06 +07:00
|
|
|
listen 443 ssl;
|
2017-11-03 03:34:07 +07:00
|
|
|
server_name login.example.com;
|
|
|
|
|
|
|
|
resolver 127.0.0.11 ipv6=off;
|
|
|
|
set $upstream_endpoint http://nginx-authelia;
|
2017-01-21 23:41:06 +07:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
2016-12-18 01:36:41 +07:00
|
|
|
|
2017-10-15 22:18:15 +07:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 23:03:18 +07:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2016-12-18 01:36:41 +07:00
|
|
|
|
2017-05-14 22:34:51 +07:00
|
|
|
location / {
|
2016-12-18 01:36:41 +07:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-03 03:34:07 +07: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 07:20:03 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
location / {
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_pass $upstream_endpoint;
|
2016-12-18 01:36:41 +07:00
|
|
|
}
|
2017-03-16 05:07:57 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2017-11-02 06:37:10 +07:00
|
|
|
listen 443 ssl;
|
2017-11-03 03:34:07 +07: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 20:22:09 +07:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
|
|
|
|
2017-10-15 22:18:15 +07:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 23:03:18 +07:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2017-10-15 22:18:15 +07:00
|
|
|
|
2017-09-03 20:22:09 +07:00
|
|
|
location /auth_verify {
|
|
|
|
internal;
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_set_header Host $http_host;
|
2017-09-03 20:22:09 +07:00
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2017-10-15 21:34:39 +07:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2017-10-14 20:04:43 +07:00
|
|
|
proxy_set_header Content-Length "";
|
2017-09-03 20:22:09 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_verify;
|
2017-09-03 20:22:09 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
auth_request /auth_verify;
|
|
|
|
|
2017-10-14 20:04:43 +07:00
|
|
|
auth_request_set $redirect $upstream_http_redirect;
|
|
|
|
|
2017-09-03 20:22:09 +07: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-03 03:34:07 +07:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-02 06:37:10 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-02 06:37:10 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_endpoint;
|
2017-09-03 20:22:09 +07:00
|
|
|
}
|
2017-10-14 20:04:43 +07: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-03 03:34:07 +07:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-02 06:37:10 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_headers;
|
2017-11-02 01:23:45 +07:00
|
|
|
}
|
2017-09-03 20:22:09 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2017-11-02 06:37:10 +07:00
|
|
|
listen 443 ssl;
|
2017-11-03 03:34:07 +07: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 20:22:09 +07:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
|
|
|
|
2017-10-15 22:18:15 +07:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 23:03:18 +07:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2017-10-15 22:18:15 +07:00
|
|
|
|
2017-09-03 20:22:09 +07:00
|
|
|
location /auth_verify {
|
|
|
|
internal;
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_set_header Host $http_host;
|
2017-09-03 20:22:09 +07:00
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2017-10-15 21:34:39 +07:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2017-10-14 20:04:43 +07:00
|
|
|
proxy_set_header Content-Length "";
|
2017-09-03 20:22:09 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_verify;
|
2017-09-03 20:22:09 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
auth_request /auth_verify;
|
2017-10-14 20:04:43 +07:00
|
|
|
|
2017-09-03 20:22:09 +07: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-03 03:34:07 +07:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-02 06:37:10 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-02 06:37:10 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_endpoint;
|
2017-09-03 20:22:09 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2017-11-02 06:37:10 +07:00
|
|
|
listen 443 ssl;
|
2017-11-03 03:34:07 +07: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 20:22:09 +07:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
|
|
|
|
2017-10-15 22:18:15 +07:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 23:03:18 +07:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2017-10-15 22:18:15 +07:00
|
|
|
|
2017-09-03 20:22:09 +07:00
|
|
|
location /auth_verify {
|
|
|
|
internal;
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_set_header Host $http_host;
|
2017-09-03 20:22:09 +07:00
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2017-10-15 21:34:39 +07:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2017-10-14 20:04:43 +07:00
|
|
|
proxy_set_header Content-Length "";
|
2017-09-03 20:22:09 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_verify;
|
2017-09-03 20:22:09 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
auth_request /auth_verify;
|
2017-10-14 20:04:43 +07:00
|
|
|
|
2017-09-03 20:22:09 +07: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-03 03:34:07 +07:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-02 06:37:10 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-02 06:37:10 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_endpoint;
|
2017-09-03 20:22:09 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2017-11-02 06:37:10 +07:00
|
|
|
listen 443 ssl;
|
2017-11-03 03:34:07 +07: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-16 05:07:57 +07:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
|
|
|
|
2017-10-15 22:18:15 +07:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 23:03:18 +07:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2017-10-15 22:18:15 +07:00
|
|
|
|
2017-05-14 22:34:51 +07:00
|
|
|
location /auth_verify {
|
|
|
|
internal;
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_set_header Host $http_host;
|
2017-03-16 05:07:57 +07:00
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2017-10-15 21:34:39 +07:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2017-09-23 23:02:21 +07:00
|
|
|
proxy_set_header Content-Length "";
|
2017-03-16 05:07:57 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_verify;
|
2017-03-16 05:07:57 +07:00
|
|
|
}
|
2016-12-18 01:36:41 +07:00
|
|
|
|
2017-09-03 20:22:09 +07:00
|
|
|
location / {
|
2017-05-14 22:34:51 +07:00
|
|
|
auth_request /auth_verify;
|
2017-10-14 20:04:43 +07:00
|
|
|
|
2017-09-22 22:53:18 +07:00
|
|
|
auth_request_set $redirect $upstream_http_redirect;
|
|
|
|
|
2017-09-23 02:18:38 +07:00
|
|
|
auth_request_set $user $upstream_http_remote_user;
|
2016-12-18 01:36:41 +07:00
|
|
|
proxy_set_header X-Forwarded-User $user;
|
2017-09-22 22:53:18 +07:00
|
|
|
|
2016-12-18 01:36:41 +07:00
|
|
|
auth_request_set $groups $upstream_http_remote_groups;
|
|
|
|
proxy_set_header Remote-Groups $groups;
|
2017-09-22 22:53:18 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-02 06:37:10 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-02 06:37:10 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_endpoint;
|
2016-12-18 01:36:41 +07:00
|
|
|
}
|
|
|
|
}
|
2017-09-25 04:19:03 +07:00
|
|
|
|
|
|
|
server {
|
|
|
|
listen 443 ssl;
|
2017-11-03 03:34:07 +07: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-25 04:19:03 +07:00
|
|
|
|
|
|
|
ssl on;
|
|
|
|
ssl_certificate /etc/ssl/server.crt;
|
|
|
|
ssl_certificate_key /etc/ssl/server.key;
|
|
|
|
|
2017-10-15 22:18:15 +07:00
|
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
2017-10-15 23:03:18 +07:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
2017-10-15 22:18:15 +07:00
|
|
|
|
2017-09-25 04:19:03 +07:00
|
|
|
location /auth_verify {
|
|
|
|
internal;
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_set_header Host $http_host;
|
2017-09-25 04:19:03 +07:00
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
2017-10-15 21:34:39 +07:00
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
2017-09-25 04:19:03 +07:00
|
|
|
proxy_set_header Content-Length "";
|
2017-11-02 01:23:45 +07:00
|
|
|
proxy_set_header Proxy-Authorization $http_authorization;
|
2017-09-25 04:19:03 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_verify;
|
2017-09-25 04:19:03 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
auth_request /auth_verify;
|
2017-10-14 20:04:43 +07:00
|
|
|
|
2017-09-25 04:19:03 +07: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-03 03:34:07 +07:00
|
|
|
proxy_set_header Host $http_host;
|
2017-11-02 06:37:10 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-02 06:37:10 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_endpoint;
|
2017-09-25 04:19:03 +07:00
|
|
|
}
|
2017-11-02 01:23:45 +07: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-03 03:34:07 +07:00
|
|
|
error_page 401 =302 https://login.example.com:8080?redirect=$redirect;
|
|
|
|
error_page 403 = https://login.example.com:8080/error/403;
|
2017-11-02 01:23:45 +07:00
|
|
|
|
2017-11-03 03:34:07 +07:00
|
|
|
proxy_pass $upstream_headers;
|
2017-11-02 01:23:45 +07:00
|
|
|
}
|
2017-09-25 04:19:03 +07:00
|
|
|
}
|
2016-12-18 01:36:41 +07:00
|
|
|
}
|
2017-03-16 05:07:57 +07:00
|
|
|
|