1830168 Members
5073 Online
109999 Solutions
New Discussion

Localhost

 
SOLVED
Go to solution
Kyle D. Harris
Regular Advisor

Localhost

My question is in /etc/hosts why is 127.0.0.1 there?

I put in my IP address for my server and then the server name (mcsd5.ala.usmc.mil) ...

Yet when i'm following directions @ http://www.meritonlinesystems.com/docs/apache_tomcat_redhat.html

On part 6.0 it says setting up your domain. My domain is already set up but why would 127.0.0.1 be there?
5 REPLIES 5
Bruce Copeland
Trusted Contributor
Solution

Re: Localhost

DO NOT TRY TO REMOVE THIS LINE!!!! You have been warned .

127.0.0.1 is what you need for the loopback (lo or localhost) interface. Your own local machine needs to be able to do a lot of things without having to have a working network (eht0, wlan0, etc) or internet interface. That's what 127.0.0.1 is used for. In most cases, if you remove the 127.0.0.1, your computer won't run at all.

Bruce
Sergejs Svitnevs
Honored Contributor

Re: Localhost

The localhost entry lists a special address that refers to the local host itself (a kind of /dev/tty for hosts). This is pretty much the standard way of referencing the local machine, and not having a "localhost" reference in your /etc/hosts file will break some programs and scripts.

Regards,
Sergejs
Tim Sanko
Trusted Contributor

Re: Localhost

Localhost entry in the hosts file is only important if you want to be able to send and recieve data on IP.

If you have IP configured, but the system communicates with the internet via modem not ethernet and not with any other systems on a network.(secure workstation type scenario), then it isn't relevant to what you do. If you want to continue using ethernet post reboot...


Tim
Steven E. Protter
Exalted Contributor

Re: Localhost

localhost is the network of last resort and your system will not function properly even with no networking without this line.

If you are using this redhat machine for local web development or hosting and intend no outsiders to ever access the html docs and whatnot, you can reconfigure apache httpd.conf file to make localhost or 127.0.0.1 the name of the webserver.

Thats what they are talking about.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
I.Delic
Super Advisor

Re: Localhost

Hi,
127.0.0.1 is needed for an loopback test.
Do not delete it


Good luck

Idriz