Created
January 12, 2018 11:28
-
-
Save sambrightman/47606b400c90ed5651b22c980a5e7410 to your computer and use it in GitHub Desktop.
Nginx reverse proxy to private server with SSL and LDAP-based authentication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 8000 ssl; | |
server_name example.com; | |
ssl_certificate example.com.crt; | |
ssl_certificate_key example.com.key; | |
error_page 497 https://$host:$server_port$request_uri; | |
location /latencies/ { | |
auth_request /auth-proxy; | |
proxy_pass http://localhost:8080/; | |
proxy_set_header Host $http_host; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} | |
location = /auth-proxy { | |
internal; | |
# https://github.com/sambrightman/nginx-ldap-auth | |
proxy_pass http://localhost:8888; | |
proxy_pass_request_body off; | |
proxy_set_header Content-Length ""; | |
proxy_set_header X-Ldap-Template "(&(objectClass=person)(departmentNumber=Team)(uid={username}))"; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment