Deactivated buffering to reduce reverse proxy as bottle neck

This commit is contained in:
Kevin Veen-Birkenbach 2022-01-29 19:07:44 +01:00
parent a6e50e5041
commit 9734848663
2 changed files with 11 additions and 0 deletions

View File

@ -11,3 +11,7 @@ curl -I {{address}}
## performance ## performance
- https://stackoverflow.com/questions/33703230/caching-images-on-all-folder-levels-of-nginx-reverse-proxy - https://stackoverflow.com/questions/33703230/caching-images-on-all-folder-levels-of-nginx-reverse-proxy
- https://www.tweaked.io/guide/nginx-proxying/ - https://www.tweaked.io/guide/nginx-proxying/
- https://serverfault.com/questions/796735/nginx-reverse-proxy-is-slow/796740
- https://serverfault.com/questions/741610/what-is-the-difference-between-proxy-request-buffering-and-proxy-buffering-on-ng
- https://askubuntu.com/questions/1103626/should-i-enable-client-max-body-size-proxy-request-buffering-and-proxy-bufferin
- https://serverfault.com/questions/692577/whats-the-difference-between-proxy-buffer-and-proxy-cache-module-in-nginx-confi

View File

@ -6,11 +6,16 @@ location /
proxy_pass http://127.0.0.1:{{http_port}}/; proxy_pass http://127.0.0.1:{{http_port}}/;
{% endif %} {% endif %}
# headers
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https; proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Port 443; proxy_set_header X-Forwarded-Port 443;
# deactivate buffering
proxy_buffering off;
proxy_request_buffering off;
# timeouts # timeouts
proxy_connect_timeout 1s; proxy_connect_timeout 1s;
proxy_send_timeout 300s; proxy_send_timeout 300s;
@ -19,6 +24,7 @@ location /
# cache media files # cache media files
location ~* \.(gif|ico|jpg|jpeg|png|svg|mp4|mp3|pdf)$ { location ~* \.(gif|ico|jpg|jpeg|png|svg|mp4|mp3|pdf)$ {
proxy_buffering on;
proxy_cache cache; proxy_cache cache;
proxy_cache_key $host$uri$is_args$args; proxy_cache_key $host$uri$is_args$args;
proxy_cache_revalidate on; proxy_cache_revalidate on;
@ -37,6 +43,7 @@ location /
# cache content # cache content
location ~* \.(html|css|js)$ { location ~* \.(html|css|js)$ {
proxy_buffering on;
proxy_cache cache; proxy_cache cache;
proxy_cache_key $host$uri$is_args$args; proxy_cache_key $host$uri$is_args$args;
proxy_cache_revalidate on; proxy_cache_revalidate on;