My question is I just want my domain to redirect to localhost:8080/habpanel/index.html#/ only. Because the other UIs don’t appeal much to me.
How can I edit the nginx conf file to do that? I try to replace “http://localhost:8080” by “http://localhost:8080 localhost:8080/habpanel/index.html#/” but the result always say : “Connection lost” on my web browser
Has anyone been able to figure this out? I have mine set up as habpanel.mydomain.local but get the dreaded “connection lost” and I think it’s because it’s trying to access files outside of the /habpanel directory (like /rest) but can’t reach them because the folder doesn’t exist under /habpanel, it’s above it in the directory structure. If there was a way to have all 404 errors redirect to servername.mydomain.local:8080/path in NGINX I think it would work but i’ve had no luck figuring out how to do that.
I have also set up openhab.mydomain.local to redirect to servername.mydomain.local:8080 and all dashboards work fine this way but having to select which one every time is kind of annoying if i’m not using a bookmark.
Sorry, I have both a default one and a Habpanel one. Both habpanel.mydomain.local and openhab.mydomain.local resolve just fine from both the openhab box and the client. It’s honestly probably wrong but i’ve had such a hard time trying to find a good tutorial on this scenario with NGINX so any input is greatly appreciated:
Habpanel (loads but gets “connection lost” because it can’t reach habpanel.mydomain.local/rest)
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
proxy_pass http://openhab.mydomain.local:8080/;
}
# the rest of the default file comments
}
I was able to hack it to work with the following config, but there must be a better way than to keep adding location blocks every time there’s a bad URL
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
server {
listen 80;
listen [::]:80;
server_name habpanel.mydomain.local;
root /var/www/html;
index index.html index.htm;
location /rest/ {
proxy_pass http://openhab.mydomain.local:8080/rest/;
}
location /static/ {
proxy_pass http://openhab.mydomain.local:8080/static/;
}
location / {
proxy_pass http://openhab.mydomain.local:8080/habpanel/;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Hello everybody,
Do you find a solution ? I have the same problem. I need to load only one panel : habpanel. I need to block all except habpanel… because i don’t want someone delete something in paperui or other…