Skip to content

Instantly share code, notes, and snippets.

@brendtumi
Created October 13, 2017 13:49
Show Gist options
  • Save brendtumi/5383c71a597ba4a99f63b21d427bf59a to your computer and use it in GitHub Desktop.
Save brendtumi/5383c71a597ba4a99f63b21d427bf59a to your computer and use it in GitHub Desktop.
Nginx proxy for nodejs
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name localhost;
access_log off;
error_log off;
client_max_body_size 30M;
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm|json|otf|eot|svg|ttf|woff|woff2)$ {
root /home/ubuntu/app/public;
}
location ~ \.(asp|aspx|php|jsp|cgi|cgii|pl|py|exe|dll|msi)$ {
return 410;
}
location ~ /TWiki|WebHome|cgi-bin|portal|foswiki|spywall|setseed-hub|pma|mysql|sql/ig {
return 410;
}
location / {
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwared-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://127.0.0.1:4321/;
proxy_redirect off;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment