Skip to content

Instantly share code, notes, and snippets.

@mateusfreira
Created March 28, 2016 02:12
Show Gist options
  • Save mateusfreira/c502ca56b14d1b296a21 to your computer and use it in GitHub Desktop.
Save mateusfreira/c502ca56b14d1b296a21 to your computer and use it in GitHub Desktop.
Upstream Nginx Sample
upstream yoursiteName {
server 127.0.0.1:9090 max_fails=1;
server 127.0.0.1:9091 max_fails=3 backup;
server 127.0.0.1:9090 max_fails=3 fail_timeout=600s backup;
}
server {
listen 80;
server_name www.yoursite.com.br yoursite.com.br;
access_log /var/log/yoursite.access.log main;
client_max_body_size 20M;
location / {
proxy_pass http://yoursiteName;
proxy_next_upstream error http_502;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 700;
proxy_set_header Host $http_host;
proxy_pass_header Set-Cookie;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment