How to create proxy pass
NGINX upstream module defines groups of backend servers to distribute traffic using load balancing algorithms. These groups can mix servers on different ports, TCP, or UNIX sockets. By default, NGINX uses a weighted round-robin balancing method to distribute requests equally among servers, but you can customize this behavior based on your needs.
To create an upstream group, go to the NGINX => Add proxy => Upstream section and follow the steps below.
1. Select a server
Choose which NGINX server will use this upstream configuration from the drop-down list.
2. Name
Assign a name for your upstream group.
3. Balance
Configure how traffic distributes across servers:
- Ip_hash — sticky sessions by client IP
- Least_conn — prioritizes least busy servers
- Random — random selection
- Round-robin — assigns a weight to each server based on its capacity or performance
4. Keepalive
Specify how many idle connections to maintain per worker.
5. Servers
Add your backend servers, specifying their IP addresses and ports. Also specify the number of unsuccessful attempts to mark server down and the time during which the specified number of unsuccessful attempts should happen to consider the server unavailable.
After this, click Add to finish the upstream group creation.
To edit the created upstream group, go to the NGINX => Config section, select the server from the drop-down list, select your upstream configuration, and click Edit.
Here you can modify load balancing algorithm, adjust keepalive connection limits, and manage backend servers (add, remove, or update parameters).