quoter/nginx.conf.sigil

53 lines
1.9 KiB
Plaintext
Raw Normal View History

2023-10-11 17:08:25 +00:00
{{ $proxy_settings := "proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_set_header Host $http_host; proxy_set_header X-Request-Start $msec;" }}
{{ range $port_map := .PROXY_PORT_MAP | split " " }}
{{ $port_map_list := $port_map | split ":" }}
{{ $scheme := index $port_map_list 0 }}
{{ $listen_port := index $port_map_list 1 }}
{{ $upstream_port := index $port_map_list 2 }}
server {
{{ if eq $scheme "http" }}
2025-06-02 19:20:37 +00:00
listen [::]:{{ $listen_port }};
listen {{ $listen_port }};
server_name {{ $.NOSSL_SERVER_NAME }};
client_max_body_size 100M;
2023-10-11 17:08:25 +00:00
{{ else if eq $scheme "https" }}
2025-06-02 19:20:37 +00:00
listen [::]:{{ $listen_port }} ssl http2;
listen {{ $listen_port }} ssl http2;
server_name {{ $.NOSSL_SERVER_NAME }};
ssl_certificate {{ $.APP_SSL_PATH }}/server.crt;
ssl_certificate_key {{ $.APP_SSL_PATH }}/server.key;
2025-06-02 21:34:12 +00:00
ssl_protocols TLSv1.2 TLSv1.3;
2025-06-02 19:20:37 +00:00
ssl_prefer_server_ciphers off;
client_max_body_size 100M;
2023-10-11 17:08:25 +00:00
{{ end }}
location / {
2023-10-18 11:29:50 +00:00
proxy_pass http://{{ $.APP }}-{{ $upstream_port }};
{{ $proxy_settings }}
2023-10-11 17:08:25 +00:00
}
2025-06-02 21:35:32 +00:00
# Browser caching for media files
2025-06-02 21:34:12 +00:00
location ~* \.(jpg|jpeg|png|gif|ico|webp|mp3|wav|ogg|flac|aac|aif|webm|pdf)$ {
2025-06-02 21:35:32 +00:00
proxy_pass http://{{ $.APP }}-{{ $upstream_port }};
2025-06-02 19:20:37 +00:00
expires 30d;
2025-06-02 21:34:12 +00:00
add_header Cache-Control "public, immutable";
2025-06-02 19:20:37 +00:00
}
2025-06-02 21:34:12 +00:00
include {{ $.DOKKU_ROOT }}/{{ $.APP }}/nginx.conf.d/*.conf;
2023-10-11 17:08:25 +00:00
}
2023-10-18 11:07:57 +00:00
{{ end }}
{{ range $upstream_port := $.PROXY_UPSTREAM_PORTS | split " " }}
upstream {{ $.APP }}-{{ $upstream_port }} {
{{ range $listeners := $.DOKKU_APP_WEB_LISTENERS | split " " }}
{{ $listener_list := $listeners | split ":" }}
{{ $listener_ip := index $listener_list 0 }}
{{ $listener_port := index $listener_list 1 }}
server {{ $listener_ip }}:{{ $upstream_port }};
{{ end }}
}
2023-10-18 11:29:50 +00:00
{{ end }}