2019-04-24 17:08:05 +02:00
|
|
|
server {
|
2023-01-18 19:54:27 +01:00
|
|
|
{{ if not .ssl }}
|
|
|
|
listen 6052 default_server;
|
|
|
|
{{ else }}
|
|
|
|
listen 6052 default_server ssl http2;
|
|
|
|
{{ end }}
|
2019-04-24 17:08:05 +02:00
|
|
|
|
|
|
|
include /etc/nginx/includes/server_params.conf;
|
2019-05-11 15:12:30 +02:00
|
|
|
include /etc/nginx/includes/proxy_params.conf;
|
2019-06-06 13:14:20 +02:00
|
|
|
|
2023-01-18 19:54:27 +01:00
|
|
|
{{ if .ssl }}
|
|
|
|
include /etc/nginx/includes/ssl_params.conf;
|
2019-06-06 13:14:20 +02:00
|
|
|
|
2023-01-18 19:54:27 +01:00
|
|
|
ssl_certificate /ssl/{{ .certfile }};
|
|
|
|
ssl_certificate_key /ssl/{{ .keyfile }};
|
2019-04-24 17:08:05 +02:00
|
|
|
|
2019-05-11 15:12:30 +02:00
|
|
|
# Redirect http requests to https on the same port.
|
2019-04-24 17:08:05 +02:00
|
|
|
# https://rageagainstshell.com/2016/11/redirect-http-to-https-on-the-same-port-in-nginx/
|
|
|
|
error_page 497 https://$http_host$request_uri;
|
2023-01-18 19:54:27 +01:00
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
# Clear Home Assistant Ingress header
|
|
|
|
proxy_set_header X-HA-Ingress "";
|
2019-04-24 17:08:05 +02:00
|
|
|
|
|
|
|
location / {
|
|
|
|
proxy_pass http://esphome;
|
|
|
|
}
|
|
|
|
}
|