2020-12-24 14:27:31 +01:00
|
|
|
location /
|
|
|
|
{
|
2021-01-01 21:05:58 +01:00
|
|
|
{% 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 %}
|
2021-01-02 10:39:20 +01:00
|
|
|
|
2020-12-24 14:27:31 +01:00
|
|
|
proxy_set_header Host $host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
|
|
|
|
proxy_connect_timeout 300;
|
|
|
|
proxy_send_timeout 300;
|
|
|
|
proxy_read_timeout 300;
|
|
|
|
send_timeout 300;
|
2021-01-02 10:39:20 +01:00
|
|
|
|
2021-01-02 11:26:23 +01:00
|
|
|
# cache media files
|
|
|
|
location ~* \.(gif|ico|jpg|jpeg|png|svg|mp4|mp3|pdf)$ {
|
2021-01-02 10:39:20 +01:00
|
|
|
proxy_cache cache;
|
|
|
|
proxy_cache_key $host$uri$is_args$args;
|
2021-01-02 11:50:55 +01:00
|
|
|
proxy_cache_valid 200 301 302 365d;
|
2021-01-02 10:39:20 +01:00
|
|
|
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)$ {
|
2021-01-01 23:27:12 +01:00
|
|
|
proxy_cache cache;
|
|
|
|
proxy_cache_key $host$uri$is_args$args;
|
|
|
|
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 %}
|
|
|
|
}
|
2020-12-24 14:27:31 +01:00
|
|
|
}
|