Last active
August 29, 2015 14:00
-
-
Save taka-wang/11105126 to your computer and use it in GitHub Desktop.
ngnix ssl for node.js application
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
upstream nodejs { | |
server 127.0.0.1:3000; | |
} | |
server { | |
listen 443; | |
ssl on; | |
server_name localhost; | |
ssl_certificate /etc/nginx/certs/server.crt; | |
ssl_certificate_key /etc/nginx/certs/server.key; | |
ssl_client_certificate /etc/nginx/certs/ca.crt; | |
ssl_verify_client optional; # on | |
add_header Strict-Transport-Security max-age=500; | |
location / { | |
proxy_pass http://nodejs; | |
proxy_redirect off; | |
proxy_set_header Host $host ; | |
proxy_set_header X-Real-IP $remote_addr ; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ; | |
proxy_set_header X-Forwarded-Proto https; | |
} | |
} |
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
curl -v -s -k --key client.key --cert client.crt https://example.com | |
wget --certificate=client.crt --private-key=client.key --no-check-certificate https://example.com -qO- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment