Improve Nginx reverse proxy example
All checks were successful
continuous-integration/drone/pr Build is passing

By default, Nginx does proxy buffering and it may store big replies to a
temporary file up to 1 GB.  It also means that Nginx will read data as
fast as possible from Garage, even if the client downloads slowly.  Both
behaviours are often not wanted, so disable this temporary file in the example.

Ref: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering

Also add an example of upstream with a "backup" server, which may be
useful to only use remote servers as fallback.
This commit is contained in:
Baptiste Jonglez 2022-11-11 21:45:03 +01:00
parent 66f2daa025
commit 8dfc909759

View file

@ -70,14 +70,16 @@ A possible configuration:
```nginx
upstream s3_backend {
# if you have a garage instance locally
# If you have a garage instance locally.
server 127.0.0.1:3900;
# you can also put your other instances
# You can also put your other instances.
server 192.168.1.3:3900;
# domain names also work
# Domain names also work.
server garage1.example.com:3900;
# you can assign weights if you have some servers
# that are more powerful than others
# A "backup" server is only used if all others have failed.
server garage-remote.example.com:3900 backup;
# You can assign weights if you have some servers
# that can serve more requests than others.
server garage2.example.com:3900 weight=2;
}
@ -96,6 +98,8 @@ server {
proxy_pass http://s3_backend;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
# Disable buffering to a temporary file.
proxy_max_temp_file_size 0;
}
}
```