Skip to content

Instantly share code, notes, and snippets.

@mveinot
Created February 16, 2024 22:59
Show Gist options
  • Save mveinot/099062bc53c6aed4dd3a971eba91785a to your computer and use it in GitHub Desktop.
Save mveinot/099062bc53c6aed4dd3a971eba91785a to your computer and use it in GitHub Desktop.
Nginx config for homeassistant
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
# Update this line to be your domain
server_name homeassistant.domain.net;
# These shouldn't need to be changed
listen 80;
return 301 https://$host$request_uri:443;
}
server {
# Update this line to be your domain
server_name homeassistant.domain.net;
# Ensure these lines point to your SSL certificate and key
ssl_certificate /etc/letsencrypt/live/homeassistant.domain.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/homeassistant.domain.net/privkey.pem;
# Ensure this line points to your dhparams file
ssl_dhparam /etc/nginx/ssl/dhparams.pem;
# These shouldn't need to be changed
listen 443 http2 ssl;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
# ssl on; # Uncomment if you are using nginx < 1.15.0
ssl_protocols TLSv1.2;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
proxy_buffering off;
location / {
proxy_pass http://192.168.10.76: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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment