Skip to content

Instantly share code, notes, and snippets.

@yassineselmi
Last active February 12, 2024 06:30
Show Gist options
  • Select an option

  • Save yassineselmi/1993be5b55d6a3206d4e548c69b9798f to your computer and use it in GitHub Desktop.

Select an option

Save yassineselmi/1993be5b55d6a3206d4e548c69b9798f to your computer and use it in GitHub Desktop.
SWAG Home assistant configuration
http {
upstream docker-homeassistant {
server homeassistant:8123;
}
upstream docker-nodered {
server homeassistant:1880;
}
upstream docker-mqtt {
server homeassistant:1883;
}
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name mydomain.duckdns.org;
# enable subfolder method reverse proxy confs
include /config/nginx/proxy-confs/*.subfolder.conf;
# all ssl related config moved to ssl.conf
include /config/nginx/ssl.conf;
# enable for ldap auth
include /config/nginx/ldap.conf;
# enable for Authelia
include /config/nginx/authelia-server.conf;
# enable for geo blocking
# See /config/nginx/geoip2.conf for more information.
#if ($allowed_country = no) {
#return 444;
#}
client_max_body_size 0;
# NodeRED
location /nodered {
# Allow / Deny private and public networks
allow 192.168.100.0/24;
deny all;
proxy_pass http://docker-nodered;
include /config/nginx/proxy.conf;
}
# MQTT
location /mqtt {
allow 192.168.100.0/24;
deny all;
proxy_pass http://docker-mqtt;
include /config/nginx/proxy.conf;
}
location /api/websocket {
allow all;
proxy_pass http://docker-homeassistant/api/websocket;
include /config/nginx/proxy.conf;
}
location / {
# Allow / Deny private and public networks
allow 192.168.0.0/24;
# allow xxx.xxx.xxx.xxx # a public IP address (for ex: your mobile IP)..
deny all;
proxy_pass http://docker-homeassistant;
include /config/nginx/proxy.conf;
}
}
}
@EvoSems
Copy link

EvoSems commented Feb 12, 2024

hi mate. following your guide. where do I place this config file? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment