forked from childe/ldap-nginx-golang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
45 lines (35 loc) · 1.25 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
error_log /var/log/nginx/error.log debug;
events { }
http {
proxy_cache_path cache/ keys_zone=auth_cache:10m;
# Change the IP address if the daemon is not running on the
# same host as NGINX/NGINX Plus.
# the real service , such as elasticsearch
upstream backend {
server 127.0.0.1:9200;
}
# NGINX/NGINX Plus listen on port 80 for requests that require
# authentication. Change the port number as appropriate.
server {
listen 80;
# Protected application
location / {
auth_request /auth-proxy;
proxy_pass http://backend/;
}
location = /auth-proxy {
internal;
# The ldap-auth daemon listens on port 8080, as set
# in nginx-ldap-daemon.go
# Change the IP address if the daemon is not running on
# the same host as NGINX/NGINX Plus.
proxy_pass http://127.0.0.1:8080;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_cache auth_cache;
proxy_cache_valid 200 403 10m;
# The following directive adds the cookie to the cache key
proxy_cache_key "$http_authorization$cookie_nginxauth";
}
}
}