mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-23 05:01:04 +01:00
63 lines
1.9 KiB
Django/Jinja
63 lines
1.9 KiB
Django/Jinja
location /
|
|
{
|
|
{% if https_port is defined %}
|
|
proxy_pass https://127.0.0.1:{{https_port}}/;
|
|
{% else %}
|
|
proxy_pass http://127.0.0.1:{{http_port}}/;
|
|
{% endif %}
|
|
|
|
# headers
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header X-Forwarded-Port 443;
|
|
|
|
# deactivate buffering
|
|
proxy_buffering off;
|
|
proxy_request_buffering off;
|
|
|
|
# timeouts
|
|
proxy_connect_timeout 1s;
|
|
proxy_send_timeout 300s;
|
|
proxy_read_timeout 300s;
|
|
send_timeout 300s;
|
|
|
|
# cache media files
|
|
location ~* \.(gif|ico|jpg|jpeg|png|svg|mp4|mp3|pdf)$ {
|
|
proxy_buffering on;
|
|
proxy_cache cache;
|
|
proxy_cache_key $host$uri$is_args$args;
|
|
proxy_cache_revalidate on;
|
|
proxy_cache_min_uses 1;
|
|
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
|
proxy_cache_lock on;
|
|
proxy_cache_background_update on;
|
|
proxy_cache_valid 200 301 302 365d;
|
|
expires 365d;
|
|
{% if https_port is defined %}
|
|
proxy_pass https://127.0.0.1:{{https_port}};
|
|
{% else %}
|
|
proxy_pass http://127.0.0.1:{{http_port}};
|
|
{% endif %}
|
|
}
|
|
|
|
# cache content
|
|
location ~* \.(html|css|js)$ {
|
|
proxy_buffering on;
|
|
proxy_cache cache;
|
|
proxy_cache_key $host$uri$is_args$args;
|
|
proxy_cache_revalidate on;
|
|
proxy_cache_min_uses 1;
|
|
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
|
|
proxy_cache_lock on;
|
|
proxy_cache_background_update on;
|
|
proxy_cache_valid 200 301 302 30m;
|
|
expires 30m;
|
|
{% if https_port is defined %}
|
|
proxy_pass https://127.0.0.1:{{https_port}};
|
|
{% else %}
|
|
proxy_pass http://127.0.0.1:{{http_port}};
|
|
{% endif %}
|
|
}
|
|
}
|