You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
container-overlay/profiles/templates/homeassistant/nginx/homeassistant.conf

55 lines
1.4 KiB

# Calculate path=/etc/nginx/sites-enabled exists(/etc/nginx/sites-enabled/#-cut()-#)== exists(/var/calculate/www/homeassistant/homeassistant-live)!= comment=#
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
#?ini(homeassistant.protocol)==https#
server {
listen 80;
server_name #-ini(homeassistant.domain)-#;
return 301 https://#-ini(homeassistant.domain)-#$request_uri;
}
#ini#
server {
server_name #-ini(homeassistant.domain)-#;
#?ini(homeassistant.protocol)==https#
ssl_certificate /var/calculate/ssl/fullchain.pem;
ssl_certificate_key /var/calculate/ssl/privkey.pem;
listen 443 ssl;
#!ini#
listen 80;
#ini#
# Home Assistant
location / {
proxy_pass http://127.0.0.1:8123;
proxy_set_header Host $host;
proxy_redirect http:// https://;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
# Zigbee2MQTT
location /#-ini(nginx.zigbee2mqtt_subpath)-#/ {
proxy_pass http://localhost:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /#-ini(nginx.zigbee2mqtt_subpath)-#/api {
proxy_pass http://localhost:8080/api;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}