Dashboard, "Home" Site Issues using sub-directory

Tags: #<Tag:0x00007f3b7f93b108>

Hi,

A couple recent items I noticed with the webui - they seem to have changed, was sort of waiting on them to revert to the old way of working, but no joy. So capturing them here to see if others are having similar issues.

  1. the overview page / URL works fine, but if I select the LibreNMS “icon” in the upper left corner, and overview goes away (i.e. base page) -> 404, Not Found.
  2. I can manually add overview to the tail of the URL, then things work. But I do see two default dashboards?
  3. if I select any dashboard (and the URL gets /?dashboard=# appended) .=> 404, Not Found. I did find this, https://github.com/librenms/librenms/issues/6822 … but I can’t add any number, none seem to work?

Thoughts?

Thanks!

I’m not seeing any of those issues.

what version are you on? Post validate please

Sure, NP! Thinking it may be a hangover due to updates over time? In any case, here is the validate output. Thanks!

[email protected]:~$ ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS  | 1.66-21-g752b3e7db
DB Schema | 2020_07_29_143221_add_device_perf_index (172)
PHP       | 7.4.3
Python    | 3.8.2
MySQL     | 8.0.21-0ubuntu0.20.04.3
RRDTool   | 1.7.2
SNMP      | NET-SNMP 5.8
====================================

[OK]    Composer Version: 1.10.10
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct
[WARN]  Your local git contains modified files, this could prevent automatic updates.
        [FIX]:
        You can fix this with ./scripts/github-remove
        Modified Files:
         LibreNMS/Util/Url.php
         html/.htaccess

Did you edit Url.php?

Also, make sure Specific URL correctly points your librenms URL in Global Settings -> System -> Server

Yes, to address another open issue (can find the link if you want that one, NP!). But just unded it (checkout to restore the file). No difference.

Checked, and it does!

Could this also be related to having a sub-path (librenms)?

Could be. To what points your LibreNMS logo upper left that you get 404?

Logo points to (same issue with or without internal domain),
http://linuxserver/librenms/ => 404 error

But if I change it to,
http://linuxserver/librenms/overview … works!

Thoughts?

Thanks!

I’m almost sure its related to the sub-directory.

Did you checked this -> https://docs.librenms.org/Extensions/Sub-Directory/ ?

Yep! Confirmed, those files look correct. Just a slight delta, in config.php,
$config['base_url'] =(!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/' . 'librenms/';

But I changed it also to match the documentation, no change. The subdirectory is working fine, but not for /overview.

Thanks!

Im almost sure that if it fails in overview, it will fail in other places.

Also, base_url is the same as Specific URL in the webui.

At this point, I dont know what more to check…Maybe webserver logs?

Good idea! I did, they got me thinking (they are below),

192.168.2.66 - - [11/Aug/2020:21:10:48 -0500] "GET /librenms/ HTTP/1.1" 404 2510 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"
192.168.2.66 - - [11/Aug/2020:21:11:00 -0500] "GET /librenms/overview HTTP/1.1" 200 88641 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.125 Safari/537.36"

The second one works (lots of traffic after that), but not the first. So I tried rather going to,
http://linuxserver/librenms/index.php

That works! So it seems the default file is not being set somehow? is this really on the web server, or rather on LibreNMS? I really mean that as a question, I’m not sure.

Thanks!

I…dont know. Sorry.

Maybe someone else could help here.

1 Like

NP, thanks for trying!

FYI, I do see in htaccess,
RewriteRule ^(.*)$ index.php
Odd that it’s not appending index.php (as it all works if I do this manually - and it used to work!).

I did also try in the apache configuration file,
DirectoryIndex index.php
But no difference.

Thanks again.

Try searching in google apache rewrite doesnt work in sub directory or something like that

Yep, tried that! And also, added the RewriteRule to apache (conf file) - no joy. It is interesting that the trailing slash is appended (and no index.php). Not sure if that’s it or not, but does seem a bit odd.

Still trying to get to the bottom of this, pulling my hair out :frowning_face:. It seems like the home page should append “overview” … do I have that right? If I manually add it, then no issue, but it’s not working that way by default.

I could be wrong, but thinking the sub-path isn’t appending this as it should.

Thanks!

Hello,

I came across this topic while searching for a solution to a near-identical issue I had. Actual I would call it truly identical except I’m using nginx (and I think OP is using Apache).

I have setup several LibreNMS sites so it surprised me to come across this issue (my other sites worked fine in this regard).

So I solved it… I will tell you how but I’m still scratching my head on it… because it’s one of those where I made a change to fix it, and then I reverted the change to ‘prove’ the fix yet now I cannot reproduce the problem!

In my case the issue seemed to be in the nginx configuration for php (/etc/nginx/conf.d/librenms.conf).

The version that did NOT work (in regards to the upper-left icon taking a user to the home/overview page):

server {
 listen      80;
 server_name librenms-xxx.xxxxx.xxx;
 root        /opt/librenms/html;
 index       index.php;

charset utf-8;
 gzip on;
 gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
 location / {
  try_files $uri $uri/ /index.php?$query_string;
 }
 location ~ [^/]\.php(/|$) {
  fastcgi_pass unix:/run/php-fpm-librenms.sock;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  include fastcgi.conf;
 }
 location ~ /\.(?!well-known).* {
  deny all;
 }
}

And the version that worked (after restarting all services):

server {
 listen      80;
 server_name librenms-xxx.xxxxx.xxx;
 root        /opt/librenms/html;
 index       index.php;

 charset utf-8;
 gzip on;
 gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
 location / {
  try_files $uri $uri/ /index.php?$query_string;
 }
 location /api/v0 {
  try_files $uri $uri/ /api_v0.php?$query_string;
 }
 location ~ \.php {
  include fastcgi.conf;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_pass unix:/run/php-fpm-librenms.sock;
 }
 location ~ /\.ht {
  deny all;
 }
}

I have two guesses… the ‘deny all’ clause at the bottom, or the ownership/permission on php-fpm-librenms.sock.

Sorry I don’t have a more explicit ‘fix’ - but I hope this helps someone.

Appreciate the comments! Tried this though, no joy yet. FYI, I can force (manually add) index.php to the end of the URL, but then selecting items like (for example) Devices doesn’t work. Huh?!?!

But if I manually add /overview, then it’s all good. Somehow that part is getting dropped.

Thanks.

I do see that the evidence still points to something in Apache / sub-directory configuration.

In your original post… you mentioned 2 default dashboards… that doesn’t seem right (I’m still fairly new to LibreNMS but still… 2 different defaults doesn’t seem logical). You could try setting/resetting this in the Global Settings / Web UI area or perhaps in your the user profile (maybe even delete/re-create one of the dashboards).
Adding ‘overview’ to the end or clicking that upper-left icon should take you to your personally configured default dashboard (and if you haven’t set one, the default globally-configured dashboard). So perhaps your dashboard got deleted but it’s still set in your personal profile settings?

Well, deleted all the dashboards, just have one now - and that does work … but still not the top left corner. It doesn’t seem to append /overview, so then it goes nowhere. Hmmm, still very odd.

When you click the logo in the top left corner, which URL do you get (I have /librenms set in config.php, etc., that’s why it’s here),

  1. http://server/librenms/
  2. http://server/librenms/overview

The missing /overview seems to be the issue.

Thanks!