Skip to content

Instantly share code, notes, and snippets.

@kai-zer-ru
Created September 6, 2024 02:41
Show Gist options
  • Save kai-zer-ru/79d49a2143d1daaff2e08c0ac7b6dc5c to your computer and use it in GitHub Desktop.
Save kai-zer-ru/79d49a2143d1daaff2e08c0ac7b6dc5c to your computer and use it in GitHub Desktop.
HomeAssistant nginx conf
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
server_name home-assistant-domain.name;
location / {
proxy_pass http://192.168.1.16:8123;
proxy_set_header Host $host;
proxy_redirect http:// https://;
proxy_http_version 1.1;
proxy_buffering off;
proxy_max_temp_file_size 0;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/home-assistant-domain.name/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/home-assistant-domain.name/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = home-assistant-domain.name) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name home-assistant-domain.name;
listen 80;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment