Last active
January 21, 2016 07:07
-
-
Save seanhandley/b7ecaa635522f6a831ff to your computer and use it in GitHub Desktop.
Nginx Client Certs
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 443 ssl http2; | |
server_name awesomehost.ninja; | |
ssl_certificate /path/to/server.crt; | |
ssl_certificate_key /path/to/server/key | |
ssl_client_certificate /path/to/client-ca.crt; | |
ssl_verify_client optional; | |
location /secret { | |
if ($ssl_client_verify != SUCCESS) { return 403; } | |
include /path/to/upstream.conf; | |
} | |
location / { | |
include /path/to/upstream.conf; | |
} | |
} | |
upstream unicorn { | |
server unix:/var/run/unicorn.sock fail_timeout=0; | |
} |
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
proxy_pass http://unicorn; | |
proxy_read_timeout 90; | |
proxy_connect_timeout 90; | |
proxy_redirect off; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment