Delivering static images directly from Nginx.

This commit is contained in:
Christoph Haas 2021-02-13 20:10:57 +01:00
parent 3b99f3d08e
commit 3d4de2b878

View file

@ -1,4 +1,5 @@
# my own config
# Nginx configuration template based on
# https://github.com/dokku/dokku/blob/master/plugins/nginx-vhosts/templates/nginx.conf.sigil
{{ range $port_map := .PROXY_PORT_MAP | split " " }}
{{ $port_map_list := $port_map | split ":" }}
{{ $scheme := index $port_map_list 0 }}
@ -105,32 +106,38 @@ server {
proxy_set_header X-Request-Start $msec;
}
# debshots - added - deliver static images directly without asking Rails
location /public/screenshot {
alias /srv/www/{{ $.SSL_SERVER_NAME }}/screenshot;
}
{{ if $.CLIENT_MAX_BODY_SIZE }}client_max_body_size {{ $.CLIENT_MAX_BODY_SIZE }};{{ end }}
include {{ $.DOKKU_ROOT }}/{{ $.APP }}/nginx.conf.d/*.conf;
error_page 400 401 402 403 405 406 407 408 409 410 411 412 413 414 415 416 417 418 420 422 423 424 426 428 429 431 444 449 450 451 /400-error.html;
location /400-error.html {
root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
internal;
}
# debshots - commented out
#error_page 400 401 402 403 405 406 407 408 409 410 411 412 413 414 415 416 417 418 420 422 423 424 426 428 429 431 444 449 450 451 /400-error.html;
#location /400-error.html {
# root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
# internal;
#}
error_page 404 /404-error.html;
location /404-error.html {
root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
internal;
}
#error_page 404 /404-error.html;
#location /404-error.html {
# root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
# internal;
#}
error_page 500 501 503 504 505 506 507 508 509 510 511 /500-error.html;
location /500-error.html {
root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
internal;
}
#error_page 500 501 503 504 505 506 507 508 509 510 511 /500-error.html;
#location /500-error.html {
# root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
# internal;
#}
error_page 502 /502-error.html;
location /502-error.html {
root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
internal;
}
#error_page 502 /502-error.html;
#location /502-error.html {
# root {{ $.DOKKU_LIB_ROOT }}/data/nginx-vhosts/dokku-errors;
# internal;
#}
}
{{ else if eq $scheme "grpc"}}
{{ if eq $.GRPC_SUPPORTED "true"}}{{ if eq $.HTTP2_SUPPORTED "true"}}
@ -182,3 +189,4 @@ upstream {{ $.APP }}-{{ $upstream_port }} {
server {{ $listener_ip }}:{{ $upstream_port }};{{ end }}
}
{{ end }}{{ end }}