0

I have been following this install for LibreNMS https://www.linuxhelp.com/how-to-install-librenms-in-centos/. Everything has been fine until I finally started the httpd service. It spits out this error. I have a virtual host configured. This is the exact Error message:

Could not reliably determine the server's fully qualified domain name using localhost.localdomain. Set the server name directive globally.

I'll display the virtualhost in the httpd config file below.

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /opt/librenms/html/
ServerName linuxhelp1.com
CustomLog /opt/librenms/logs/access_log combined
ErrorLog /opt/librenms/logs/error_log
AllowEncodedSlashes On
<Directory "/opt/librenms/html/">
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
0

Please note that linuxhelp1.com is an example. You need the actual ServerName, which in this case will be the hyper-v ip address (x.x.x.x).

Add your hyper-v ip address (x.x.x.x) to the ServerName directive both in and outside of the virtualhost container.

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /opt/librenms/html/
ServerName x.x.x.x
CustomLog /opt/librenms/logs/access_log combined
ErrorLog /opt/librenms/logs/error_log
AllowEncodedSlashes On
<Directory "/opt/librenms/html/">
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>

Refer to this article on using NameVirtualHost and ServerName. Also, please update your question with the Apache version you are using as 1, 2.2, and 2.4 are all different in their configuration.

For instance, when upgrading from 2.2 to 2.4 you will note that

The NameVirtualHost directive no longer has any effect, other than to emit a warning. Any address/port combination appearing in multiple virtual hosts is implicitly treated as a name-based virtual host.

  • I don't believe it is globally outside of it? – LeGreen95 Jan 17 '18 at 20:35
  • add the /etc/hosts entry and also make sure ServerName is set outside the vhost directive, restart, and see if the error persists. – WEBjuju Jan 17 '18 at 20:46
  • Would it be the linuxhelp1? – LeGreen95 Jan 17 '18 at 20:52
  • is that a real domain, or just something you were using in your example? did you register that domain? it does not appear to be pointing to a server yet. anyway, if you point that domain in your etc/hosts to 127.0.0.1 and have the global httpd.conf ServerName directive pointed to that, the message may go away. you can still open the site even though apache is warning you that you aren't ready for going live (which you're not, if your domain name isn't really registered). – WEBjuju Jan 17 '18 at 21:03
  • linuxhelp.com/how-to-install-librenms-in-centos I've literally followed this. It's supposed to be a real domain? I downlownded libre from it I believe – LeGreen95 Jan 17 '18 at 21:06
0

That message is just a notice of a default choice, and can be ignored. To fix the issue generating it, in your main config file outside of any defined hosts/sites add a ServerName directive.

EG - on my Debian systems, the main config is /etc/apache2/apache2.conf - at the very bottom simply add

ServerName somehost.example.com

Of course, that FQDN doesn't need to be in DNS, just in that machines /etc/hosts file pointing at 127.0.1.1 (or whatever loopback you like).

IIRC Redhat/CentOS/etc have everything in one big httpd.conf file - if that is the case, add the line before you start defining your actual named hosts.

  • It has given me an error in my logs unauthenticated agent – LeGreen95 Jan 18 '18 at 14:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.