NGINX configuration - Start OH with Basicui

OH v2.5.5 Relase Build
Raspberry Pi3

Hi everyone, I’m trying to configure the NGINX reverse proxy but I have some problems if I want to open BASICUI directly. The schematic that appears in the browser is as follows:

server {
listen                                    80;
server_name                               xxx.xxx.xxx.xxx;

location / {
    proxy_pass                            http://localhost:8080/basicui/app/;

    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;
	
    auth_basic                            "Username and Password Required";
    auth_basic_user_file                  /etc/nginx/.htpasswd;		
}

}

if I add this:

 	location /icon/ {
	proxy_pass							  http://localhost:8080/icon/;
    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;		
}

icons appear to me but they are huge and keep the whole screen.

Can anyone help me?
Thank you!!!

A proper NGINX setup is not trivial.
But this is not an openHAB issue so please g**gle for help.

I suggest you move to openHABian, it has a menu option to install NGINX, too (with this config to work).

I would suggest adding a redirect instead:

location = / {
    return 301 /basicui/app/;
}

location / {
    proxy_pass                            http://localhost:8080/;

    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;
	
    auth_basic                            "Username and Password Required";
    auth_basic_user_file                  /etc/nginx/.htpasswd;		
}

Requests that exactly match / (http://xxx.xxx.xxx.xxx/) gets redirected to basicui, but all others work like normal.

Hello, first of all thanks for the advice,
I tried to do what you suggested but nothing has changed, I can’t see the basicui icons.
The Nginx configuration works perfectly if you enter http: // localhost: 8080 / then switch to Basicui by clicking on its link. In this way I see everything perfectly. I wanted to avoid this step but I don’t really know how.
I tried everything looking for g ** gle and surroundings but nothing …

Have you removed the /icon/ location block? Also, just to make sure, have you reloaded nginx after the changes?
Run

sudo nginx -t

to verify your config, and then

sudo nginx -s reload

to restart with the new config.

Yes, I removed the icon and checked the configuration and restarted with: sudo service nginx restart
I also emptied the browser cacke.

server {
listen                                    80;
server_name                               My_ddns;

location = / {
	return 301 							/basicui/app/;
}

location / {
    proxy_pass                            http://localhost:8080/;

    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;
	
    auth_basic                            "Username and Password Required";
    auth_basic_user_file                  /etc/nginx/.htpasswd;		
}

}

What address do you type in your browser? Your domain name or your ip address? What happens when you try to navigate to it? Does the address change to include /basicui/app/?

Edit: tried with my server and noticed the issue:
It should be

return 301 							/basicui/app;

not

return 301 							/basicui/app/;

(Remove the / at the end)

1 Like

Ooops … removing the / it works !!
Thanks for all…
When you pass in my part I owe you a dinner !!
Bye