Author: [email protected]
Last Update: 11-Aug-2024
This guide provides step-by-step instructions to set up a reverse proxy for your Home Assistant installation using NGINX and Docker. The proxy is configured to secure your Home Assistant instance with SSL certificates.
Before proceeding, ensure that the following are in place:
- Home Assistant is running and fully operational.
- Docker is installed and running on your system.
- SSL certificates have been generated using
certbot
and stored in the./ssl
directory.
- Home Assistant Version: 2024.8.1
- Hardware: Raspberry Pi 4
First, clone the repository containing the configuration files.
cd /opt
sudo git clone https://github.com/qzcl-maintainer/homeassistant-proxy.git
sudo chmod 777 /opt/homeassistant-proxy
cd homeassistant-proxy
mkdir ssl
Launch the proxy using the HTTP configuration to verify that it works correctly.
docker compose -f compose-http.yml up --detach
Connect to the running NGINX Docker container to generate Diffie-Hellman parameters.
docker container exec -it homeassistant-proxy-nginx-1 bash
Generate the dhparams.pem file, which is used for SSL/TLS key exchange.
cd /etc/nginx/ssl
openssl dhparam -out dhparams.pem 2048
exit
After verifying the HTTP proxy setup, bring down the container to apply SSL configurations.
docker compose down
Modify the default.conf
file to match your Home Assistant installation:
- server_name: Your server's domain name.
- ssl_certificate: The file path to your SSL certificate.
- ssl_certificate_key: The file path to your SSL certificate key.
- proxy_pass: The IP address and port of your Home Assistant instance.
Finally, bring the proxy online with SSL enabled.
docker compose up --detach
Navigate to https://your_server_name:8124
. You should see the Home Assistant Dashboard.
If you encounter any issues during setup, refer to the community guides: