From 0d5e13fea80523a5e6f9a67f1b78596cc9d735e9 Mon Sep 17 00:00:00 2001 From: Alexander Tratsevskiy Date: Fri, 31 Mar 2023 08:55:01 +0300 Subject: [PATCH] =?UTF-8?q?homeassistant:=20=D0=BE=D1=82=D0=BA=D0=BB=D1=8E?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=20=D0=BF=D0=BE=D1=80=D1=82=208123=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B2=D0=BD=D0=B5=D1=88=D0=BD=D0=B8=D1=85=20?= =?UTF-8?q?=D1=81=D0=BE=D0=B5=D0=B4=D0=B8=D0=BD=D0=B5=D0=BD=D0=B8=D0=B9,?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B?= =?UTF-8?q?=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20ngi?= =?UTF-8?q?nx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homeassistant/nginx/homeassistant.conf | 25 ++++++++++++++----- scripts/homeassistant/step/2-config.sh | 1 + 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/profiles/templates/homeassistant/nginx/homeassistant.conf b/profiles/templates/homeassistant/nginx/homeassistant.conf index 08d24f2..864ed0c 100644 --- a/profiles/templates/homeassistant/nginx/homeassistant.conf +++ b/profiles/templates/homeassistant/nginx/homeassistant.conf @@ -1,9 +1,22 @@ # Calculate path=/etc/nginx/sites-enabled exists(/etc/nginx/sites-enabled/#-cut()-#)== comment=# +map $http_upgrade $connection_upgrade { + default upgrade; + '' close; +} server { - listen 80 default_server; - location / { - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $http_host; - proxy_pass "http://127.0.0.1:8123"; - } + listen 80; + location / { + proxy_pass "http://127.0.0.1:8123"; + proxy_connect_timeout 60; + proxy_http_version 1.1; + proxy_intercept_errors off; + proxy_read_timeout 60; + proxy_send_timeout 60; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Host $http_host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + } } diff --git a/scripts/homeassistant/step/2-config.sh b/scripts/homeassistant/step/2-config.sh index 9ee9ab9..8eb34c9 100755 --- a/scripts/homeassistant/step/2-config.sh +++ b/scripts/homeassistant/step/2-config.sh @@ -23,6 +23,7 @@ kill $id_hass cat >> ~/.homeassistant/configuration.yaml <