Last active
August 29, 2015 13:57
-
-
Save jeffchao/9378229 to your computer and use it in GitHub Desktop.
nginx + node + ssl config
This file contains hidden or 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 foo_backend { | |
server 127.0.0.1:8080; | |
} | |
server { | |
listen 443 ssl; | |
ssl_certificate /etc/nginx/ssl/foo.com.bundle.crt; | |
ssl_certificate_key /etc/nginx/ssl/foo.com.key; | |
ssl_ciphers RC4:HIGH:!aNULL:!MD5; | |
ssl_prefer_server_ciphers on; | |
keepalive_timeout 70; | |
server_name api.foo.com; | |
access_log /var/log/nginx/access.log; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_pass http://foo_backend; | |
proxy_redirect off; | |
} | |
} | |
# If we want non-SSL as well. | |
server { | |
listen 80; | |
keepalive_timeout 70; | |
server_name api.foo.com; | |
access_log /var/log/nginx/access.log; | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-NginX-Proxy true; | |
proxy_set_header X-Forwarded-Proto https; | |
proxy_pass http://foo_backend; | |
proxy_redirect off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment