Hosts file for run a domain in your local machine

I sincerely thanks to @meetbala , for share this with me.

I added Hosts file for run a domain in your local system demo video too at below..

The hosts file is a computer file used in an operating system to map hostnames (shareourideas.com) to IP addresses.
Hosts file is one of several system facilities to assist in addressing network nodes in a computer network. It is a common part in a operating system’s Internet Protocol (IP) implementation, and serves the function of translating human-friendly hostnames (shareourideas.com) into numeric protocol addresses (for example x.x.x.x), called IP addresses, that identify a host in an IP network.
In some operating systems, the host file content is used preferentially over other methods, such as the Domain Name System (DNS), but many systems implement name service switches to provide customization. Unlike the DNS, the hosts file is under the direct control of the local computer’s administrator.

The hosts file contains lines of text consisting of an IP address in the first field followed by one or more hostnames, each field separated by white space (blanks or tabulation characters). Comment lines may be included, by using a hash character (#) in the first position of lines. Entirely blank lines in the file are ignored. For example check with below lines:
#This is an example of the hosts file – this is comment line
127.0.0.1 localhost
127.0.0.1 mydomain.com
Now you can browse the mydomain.com, so, it will automatically points to your local machine first (it may be default server IIS or apache runs with default port : 80).

Location in the file system
The location of the hosts file in the file system hierarchy of operating systems.

Operating System Version(s) Location
Microsoft Windows 95, 98/98SE, Me %WinDir%
NT, 2000, and 32-bit versions of XP,2003, Vista, 7 %SystemRoot%system32driversetc
64-bit versions %SystemRoot%system32driversetc (Many sources, including several Microsoft support pages, will incorrectly state that the hosts file is at %SystemRoot%SysWOW64driversetc)
Windows Mobile Registry key under HKEY_LOCAL_MACHINECommTcpipHosts
Unix, Unix-like, POSIX /etc/hosts
Apple Macintosh 9 and earlier System Folder: Preferences or System folder
Mac OS X 10.0 – 10.1.5 (Added through NetInfo or niload)
Mac OS X 10.2 and newer, iOS /private/etc/hosts or, since /etc is a symbolic link to /private/etc, /etc/hosts (just like POSIX)
Novell NetWare SYS:etchosts
OS/2 & eComStation "bootdrive":mptnetc
Symbian Symbian OS 6.1–9.0 C:systemdatahosts
Symbian OS 9.1+ C:private10000882hosts
Android /system/etc/hosts

Video demo :
[youtube=http://www.youtube.com/watch?v=aF57dP93ls4]

I hope it will helpful for you!!!

Enjoy while coding..!

Thanks,

Naga Harish.

  • Susianto

    Cool Posting