-
-
Save kylefinley/ddb8039c6c20abd2098a to your computer and use it in GitHub Desktop.
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 nodejs { | |
server 127.0.0.1:3000; | |
keepalive 8; | |
} | |
server { | |
listen 80; | |
listen [::]:80 ipv6only=on default_server; | |
server_name mydomain.fi; | |
return 301 https://$server_name$request_uri; | |
} | |
# the nginx server instance | |
server { | |
listen 443 default_server ssl; | |
server_name mydomain.fi; | |
access_log /var/log/nginx/mydomain.log; | |
ssl_certificate /data/myapp/data/keys/bundle.crt; | |
ssl_certificate_key /data/myapp/data/keys/ssl.key; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:EECDH+RC4:RSA+RC4:!MD5; | |
ssl_prefer_server_ciphers on; | |
ssl_session_cache shared:SS:10m; | |
ssl_session_timeout 10m; | |
keepalive_timeout 60; | |
# root /data/myapp; | |
location ~ ^/(profile/|derby/|images/|img/|javascript/|js/|css/|stylesheets/|flash/|media/|static/|robots.txt|humans.txt|favicon.png|favicon2.png) { | |
root /data/myapp/public; | |
access_log off; | |
expires max; | |
} | |
# pass the request to the node.js server with the correct headers and much more can be added, see nginx config options | |
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_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
proxy_pass http://nodejs; | |
proxy_redirect off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment