Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Proxying Traffic to a Group of Servers

Info
titleinfo

Use a reverse proxy to route inbound traffic to particular internal servers


Follow the steps below

  1. Setup an upstream block within the http block

  2. Info
    titlenginx configuration
    http
    {
        upstream my_glassfish_cluster 
        {
            server backend1.example.com weight=5;
            server 192.168.99.100:28080;
            server 192.168.99.100:28081 backup;
        }
    }

    Use weight to specify importance (1:lowest - 5:highest), use backup to specify only route to this server if all other servers in the cluster fail

  3. Now specify the upstream group that nginx will pass requests to (can be any one of the following protocols: proxy_pass, fastcgi_pass, memcached_pass, uwsgi_pass, or scgi_pass)


  4. Info
    titlenginx configuration
    http
    {
       ...
       server 
       {
          location / 
          {
             proxy_pass http://my_glassfish_cluster;
          }
       }
    }

    This will pass all http requests up to my_glassfish_cluster server group

...