LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (http://www.linuxquestions.org/questions/red-hat-31/)
-   -   Could not login to nagios through hostname (http://www.linuxquestions.org/questions/red-hat-31/could-not-login-to-nagios-through-hostname-4175444263/)

rahul.buragohain 01-05-2013 09:59 AM

Could not login to nagios through hostname
 
Hi,

I have installed nagios in centos 5.8 but I can only login by giving http://localhost/nagios and http://IPaddress/nagios

I have given my hostname as rahul in /etc/sysconfig/network and also in the /etc/hosts file as 127.0.1.1 rahul

But I want to login as http://rahul/nagios

The nagios page doesn't appears. Please help.

EricTRA 01-05-2013 10:06 AM

Hello,

Where are you trying to connect from? Another machine on the same LAN?

Kind regards,

Eric

rahul.buragohain 01-05-2013 10:13 AM

Hi eric,

I have installed nagios in my system and I am trying to login as http://rahul/nagios
The hostname of my system is rahul
Even I tried on other machine to connect from on the same LAN
But why the nagios page doesnt appear??

EricTRA 01-05-2013 10:25 AM

Hi,

Are you serving the Nagios page through Apache/httpd? It does work when you use http://localhost/nagios right, from the server itself? Does it work using http://rahul/nagios from the server itself?

Kind regards,

Eric

rahul.buragohain 01-05-2013 10:33 AM

hi eric,

Yes I have installed httpd on my system. It works when I use http://localhost/nagios

I have not installed nagios on any server. As I told you that I have installed nagios in my desktop. When I give http://localhost/nagios it works.

But if I give http://rahul/nagios from my desktop itself,it never work. Please help.

EricTRA 01-05-2013 10:35 AM

Hi,

What did you add to /etc/hosts to indicate rahul as hostname? And what do you have as value for the Listen directive in httpd.conf? And did you reload network services and the httpd daemon for the changes to take effect?

Kind regards,

Eric

rahul.buragohain 01-05-2013 10:49 AM

Hi eric,

I have added a new line as 127.0.1.1 rahul in /etc/hosts file. I have not checked httpd.conf file

EricTRA 01-05-2013 10:52 AM

Hi,

Do you mean you did it like this:
Code:

127.0.0.1  localhost.localdomain localhost
127.0.1.1  rahul

If so, why not use it like this:
Code:

127.0.0.1  localhost.localdomain localhost rahul
Also check your httpd.conf file for the value of the Listen directive. If that one is set to 127.0.0.1, then of course your solution with 127.0.1.1 will not work. And you need to reload/restart the affected services to apply changes.

Kind regards,

Eric

rahul.buragohain 01-05-2013 10:58 AM

hi eric,

yes i did like this

127.0.0.1 localhost.localdomain localhost
127.0.1.1 rahul

EricTRA 01-05-2013 11:00 AM

Hi,

And what's in the httpd.conf file for the Listen directive? Try changing your hosts file according to the example I put.

Kind regards,

Eric

rahul.buragohain 01-05-2013 11:41 AM

h eric,

Ok i will try to change the hosts file as suggested by you. My system IP address is 172.16.92.217. So if I give in the hosts file as

127.0.0.1 localhost.localdomain localhost
172.16.92.217 rahul

will it work???

I think I should also put the IP 172.16.92.217 in httpd.conf file right, if I want to access from other system in the same LAN??

please help

EricTRA 01-06-2013 03:31 AM

Hi,

If you add that line to the hosts file to indicate the host rahul, it will work from that same machine. If you want it to work across the LAN then you'll need to set up each hosts file on each and every machine you want to use so that it contains all the IPs and hostnames you want to connect. Or... setup a local DNS server.

Since it's only on your LAN I would not change Apache to only listen on the 172 IP although you could do it. If the Listen directive is set to 127.0.0.1 you can change it to 0.0.0.0 to make Apache listen on all IPs on your machine.

Kind regards,

Eric

rahul.buragohain 01-06-2013 04:06 AM

Hi eric

If my /etc/hosts file is

127.0.0.1 localhost.localdomain localhost
127.0.1.1 rahul

will it work across the LAN and shall i be able to access from all machines???

If the Listen Directive is changed to 127.0.1.1 , will apache be able to listen on all IPs of the machies in the same LAN??

EricTRA 01-06-2013 04:21 AM

Hi,

No, it will not. All addresses in the 127/8 network bind to the loopback interface (the lo interface) and not a network interface. So you either need to set it up with a LAN IP or always access on the same box.

Same thing applies to Apache. If you set the Listen directive to an IP that binds to the loopback interface then you'll only have local access. If you set the Listen directive to 0.0.0.0 it will listen on all IP addresses configured, so if you then configure your hosts file with the LAN IP and hostname on each and every machine from which you want to connect OR setup a DNS server for your LAN, it will work. Otherwise it will only work locally.

Kind regards,

Eric

rahul.buragohain 01-06-2013 04:37 AM

hi eric,

so what is ur suggestion? what should I entry in /etc/hosts file and in what value should I set in the Listen directive??


All times are GMT -5. The time now is 04:24 PM.