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
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.
|Microsoft Windows||95, 98/98SE, Me||
|NT, 2000, and 32-bit versions of XP,2003, Vista, 7||
|Windows Mobile||Registry key under
|Unix, Unix-like, POSIX||
|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||
|OS/2 & eComStation||
|Symbian||Symbian OS 6.1–9.0||
|Symbian OS 9.1+||
Video demo :
I hope it will helpful for you!!!
Enjoy while coding..!