Skip to content

Instantly share code, notes, and snippets.

@paambaati
Created February 20, 2015 15:47
Show Gist options
  • Save paambaati/9782e95b2e9af899b154 to your computer and use it in GitHub Desktop.
Save paambaati/9782e95b2e9af899b154 to your computer and use it in GitHub Desktop.
Sample nginx config with redirection issue
upstream myproject_upstream {
server 127.0.0.1:3000;
}
server {
listen 80;
root /Users/myusername/Projects/myproject/static;
server_name servername.com;
location /static/l10n {
error_page 404 = /static/l10n/en-us.json;
}
location /static {
alias /Users/myusername/Projects/myproject/static;
autoindex on;
access_log off;
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
proxy_hide_header X-Powered-By;
proxy_hide_header X-Runtime;
proxy_hide_header Server;
}
location / {
proxy_pass http://myproject_upstream;
proxy_read_timeout 90;
proxy_connect_timeout 90;
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 $scheme;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_hide_header X-Powered-By;
proxy_hide_header X-Runtime;
proxy_hide_header Server;
proxy_cache_key sfs$request_uri$scheme;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment