From 3d4de2b878a61a0849aa46d22a8c9aa4bb13b2fc Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Sat, 13 Feb 2021 20:10:57 +0100 Subject: [PATCH] Delivering static images directly from Nginx. --- nginx.conf.sigil | 50 ++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/nginx.conf.sigil b/nginx.conf.sigil index 2ee5629..cb9eb50 100644 --- a/nginx.conf.sigil +++ b/nginx.conf.sigil @@ -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 }} +