42 lines
1.3 KiB
ApacheConf
42 lines
1.3 KiB
ApacheConf
<VirtualHost *:80>
|
|
ServerName ha.example.com
|
|
|
|
DocumentRoot /var/www/empty
|
|
|
|
RewriteEngine on
|
|
RewriteCond %{REQUEST_URI} !(^/\.well-known/.*$)
|
|
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [R=307]
|
|
|
|
ErrorLog /var/log/apache2/ha.example.com.error.log
|
|
CustomLog /var/log/apache2/ha.example.com.access.log combined
|
|
</VirtualHost>
|
|
|
|
<VirtualHost *:443>
|
|
ServerName ha.example.com
|
|
|
|
SSLEngine On
|
|
#SSLCertificateFile /etc/letsencrypt/live/ha.example.com/cert.pem
|
|
#SSLCertificateKeyFile /etc/letsencrypt/live/ha.example.com/privkey.pem
|
|
#SSLCACertificateFile /etc/letsencrypt/live/ha.example.com/chain.pem
|
|
SSLCertificateFile /etc/ssl/private/ssl-cert-snakeoil.key
|
|
SSLCertificateKeyFile /etc/ssl/certs/ssl-cert-snakeoil.pem
|
|
|
|
DocumentRoot /var/www/html
|
|
|
|
# Home-Assistant
|
|
ProxyPreserveHost On
|
|
ProxyRequests off
|
|
ProxyPass /api/websocket ws://172.16.88.2:80/api/websocket
|
|
ProxyPassReverse /api/websocket ws://172.16.88.2:80/api/websocket
|
|
ProxyPass / http://172.16.88.2:80/
|
|
ProxyPassReverse / http://172.16.88.2:80/
|
|
|
|
RewriteEngine on
|
|
RewriteCond %{HTTP:Upgrade} =websocket [NC]
|
|
RewriteRule /(.*) ws://172.16.88.2:80/$1 [P,L]
|
|
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
|
|
RewriteRule /(.*) http://172.16.88.2:80/$1 [P,L]
|
|
|
|
ErrorLog /var/log/apache2/ha.example.com.error.log
|
|
CustomLog /var/log/apache2/ha.example.com.access.log combined
|
|
</VirtualHost>
|