|
Posted by Jerry Stuckle on 12/28/05 07:05
Michael wrote:
> Jerry,
>
> Thanks for your help. I guess I'm a little confused about localhost. It
> seems that if I open a file in the browser at
> http:/localhost/myFile.html, it actually refers to the file
> /var/www/html/myFile.html. So it seems there are two meanings to
> localhost? In one context it refers to the local machine via ip
> address 127.0.0.1, and in the context of the browser, (with Apache
> running?), localhost refers to a specifc directory path on the local
> machine. This is why I'm confused. Can you shed any light on this?
>
> Thanks,
> M. McDonnell
> P.S., my /etc/host file looks ok (see below).
> ================/etc/host file ================
> Do not remove the following line, or various programs
> # that require network functionality will fail.
> 127.0.0.1 McDonnell localhost.localdomain localhost
> ==========================================
>
No, in either case it's referring to the local machine.
If your domain is example.com, http://www.example.com/myFile.html would
also refer to the file /var/www/html/myFile.html. Here you're accessing
your machine through the web browser from an external source; if you
call http://localhost/myFile.html you're calling the web browser from
the same machine.
localhost always refers to the machine itself. It's the web browser
which is translating the directory.
And if you have the appropriate daemons running, you can
telnet localhost
ftp localhost
ping localhost
etc.
which does exactly the same things as
telnet example.com
ftp example.com
ping example.com
The only difference is the first ones you're calling from the local
machine; for the second group you're calling from either the same or a
different machine.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|