Skip to content

Instantly share code, notes, and snippets.

@josuebasurto
Last active February 22, 2021 07:45
Show Gist options
  • Save josuebasurto/818cf0e4fd3b5d12387fa9c0fb246237 to your computer and use it in GitHub Desktop.
Save josuebasurto/818cf0e4fd3b5d12387fa9c0fb246237 to your computer and use it in GitHub Desktop.
How to setup NginX as a Load Balancer

How to setup NginX as a Load Balancer

Make sure you have this configuration in your nginx file

log_format upstreamlog '$server_name to $upstream_addr [$request] '
  'up_resp_time $upstream_response_time'
  'msec $msec req_time $request_time';

upstream jblb{
  server 192.168.1.115;
  server 192.168.1.116;
}

server {
        listen 80 default_server;

        server_name _;
        access_log /var/log/nginx/access.log upstreamlog;

        location / {
                proxy_pass http://jblb;
        }
}

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment