|
@@ -373,6 +373,42 @@ docker run -d -p 80:80 -p 443:443 \
|
|
|
|
|
|
You'll need apache2-utils on the machine where you plan to create the htpasswd file. Follow these [instructions](http://httpd.apache.org/docs/2.2/programs/htpasswd.html)
|
|
You'll need apache2-utils on the machine where you plan to create the htpasswd file. Follow these [instructions](http://httpd.apache.org/docs/2.2/programs/htpasswd.html)
|
|
|
|
|
|
|
|
+### Upstream (Backend) Server HTTP Load Balancing Support
|
|
|
|
+
|
|
|
|
+> **Warning**
|
|
|
|
+> This feature is experimental. The behavior may change (or the feature may be removed entirely) without warning in a future release, even if the release is not a new major version. If you use this feature, or if you would like to use this feature but you require changes to it first, please [provide feedback in #2195](https://github.com/nginx-proxy/nginx-proxy/discussions/2195). Once we have collected enough feedback we will promote this feature to officially supported.
|
|
|
|
+
|
|
|
|
+If you have multiple containers with the same `VIRTUAL_HOST` and `VIRTUAL_PATH` settings, nginx will spread the load across all of them. To change the load balancing algorithm from nginx's default (round-robin), set the `com.github.nginx-proxy.nginx-proxy.loadbalance` label on one or more of your application containers to the desired load balancing directive. See the [`ngx_http_upstream_module` documentation](https://nginx.org/en/docs/http/ngx_http_upstream_module.html) for available directives.
|
|
|
|
+
|
|
|
|
+> **Note**
|
|
|
|
+> * Don't forget the terminating semicolon (`;`).
|
|
|
|
+> * If you are using Docker Compose, remember to escape any dollar sign (`$`) characters (`$` becomes `$$`).
|
|
|
|
+
|
|
|
|
+Docker Compose example:
|
|
|
|
+
|
|
|
|
+```yaml
|
|
|
|
+services:
|
|
|
|
+ nginx-proxy:
|
|
|
|
+ image: nginxproxy/nginx-proxy
|
|
|
|
+ ports:
|
|
|
|
+ - "80:80"
|
|
|
|
+ volumes:
|
|
|
|
+ - /var/run/docker.sock:/tmp/docker.sock:ro
|
|
|
|
+ environment:
|
|
|
|
+ HTTPS_METHOD: nohttps
|
|
|
|
+ myapp:
|
|
|
|
+ image: jwilder/whoami
|
|
|
|
+ expose:
|
|
|
|
+ - "8000"
|
|
|
|
+ environment:
|
|
|
|
+ VIRTUAL_HOST: myapp.example
|
|
|
|
+ VIRTUAL_PORT: "8000"
|
|
|
|
+ labels:
|
|
|
|
+ com.github.nginx-proxy.nginx-proxy.loadbalance: "hash $$remote_addr;"
|
|
|
|
+ deploy:
|
|
|
|
+ replicas: 4
|
|
|
|
+```
|
|
|
|
+
|
|
### Upstream (Backend) Server HTTP Keep-Alive Support
|
|
### Upstream (Backend) Server HTTP Keep-Alive Support
|
|
|
|
|
|
> **Warning**
|
|
> **Warning**
|