Gui 2.1.x - error in log --> open() "/var/www/mender-gui/distindex.html" failed (2: No such file or directory)

I am updating to the latest version of Mender (2.1.x) in my openshift environment. I noticed that the GUI docker container now has nginx.

The GUI seems to be working with no issues except in the logs, I see the following repeatedly:

2019/09/30 23:20:01 [error] 12#12: *504 open() “/var/www/mender-gui/distindex.html” failed (2: No such file or directory), client: 127.0.0.1, server: , request: “GET /nginx_status/ HTTP/1.1”, host: “localhost:8080”
127.0.0.1 - - [30/Sep/2019:23:20:01 +0000] “GET /nginx_status/ HTTP/1.1” 404 153 “-” “Sysdig Agent/1.0”

I can’t figure out why the nginx_status is not parsing the directory correctly. Missing a “/” between dist & index.html.

any help would be appreciated…

Hi @gil0109,
while the GUI container has nginx and the nginx_status extension installed, responding with the status is not enabled yet, thus the response to the GET /nginx_status/ request seems to be referred to the regular index.html serving.
I’m not entirely sure where the status requests are requested from in the first place, so it might help to look into your openshift configuration. Since I haven’t worked with openshift myself I can only guess that this might be coming from the Sysdig healthchecks.

As to the failure in parsing the directory correctly - that seems to be a fault in the try_files part in the nginx config. The PR fixing this is here. Thanks a lot for bringing this to light!

If you want to add the status reporting yourself in the meantime, it should be enough to mount a modified .conf file to the GUI container and let it point to /etc/nginx/nginx.conf. The modification would be to replace the server section with:

server {
    access_log /dev/stdout;
    root /var/www/mender-gui/dist;
    index index.html index.htm;
    location /nginx_status {
        stub_status on;
        allow 127.0.0.1;
        deny all;
    }
    location / {
      try_files $uri $uri/index.html /index.html;
    }
  }

to the server section. This should help the status requests and prevent the errors from appearing.

PS: the faulty definition in the try_files was the final slash here:

try_files $uri $uri/index.html >>/<<index.html;

Worked like a charm. It is strange because I am using your docker container and I have no health checks on the that container. But either way, the issue is fixed with this. I look forward to the patch going into your repo in 2.1.x