Skip to content

Instantly share code, notes, and snippets.

@antunesleo
Created November 21, 2019 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antunesleo/eec085175f40601f61825a7ae070e5d8 to your computer and use it in GitHub Desktop.
Save antunesleo/eec085175f40601f61825a7ae070e5d8 to your computer and use it in GitHub Desktop.
# With this, when you proxy_pass to all-apis, nginx automically will balance the requests between the servers.
upstream all-apis {
server your-ip-here:5000;
server another-ip-here:5000;
server a-third-ip-here:5000;
}
server {
listen 80;
client_max_body_size 600M;
server_name yoursite.example.com;
root /yoursite/www;
index index.html;
location / {
}
location /api {
# other configs...
proxy_pass http://all-apis; # passing the requests for one of the servers define above
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment