Create custom domain in localhost which all local users can access (LINUX)

Viewed 657

I want to create a custom domain name which will run on my IP

If i host a web server then if someone view 'mylocalsite.com' , then my ip web server will be shown

For Example:

My IP: 192.168.1.111

Domain: mylocalsite.com

Show my IP response in mylocalsite.com, We are talkin about LINUX

Is that Possible in anyway?

2 Answers

Recommended solution: Configure the router

Modify the configuration of your router. Most router should support custom DNS record, custom domain or something like this.

For linux-based routers such as OpenWRT and DDWRT, you can directly modify the /etc/hosts of the router, or modify the argument of dnsmasq.

Unrecommended solution: Configure every client

  • If the client is on Windows

Please refer to @S.Sachith's answer. (Modify c:\windows\system32\drivers\etc\hosts)

  • If the client is on Linux/MacOS/BSD

Please modify /etc/hosts to add the custom DNS record. Use google to find out the detailed syntax.

  • If the client is on Android/iOS

Search for hosts modifier, hosts go, or some app like this, to modify the DNS record. You can also directly modify /system/etc/hosts by hand if you have root access.

IF USERS ARE WINDOWS Not Recommend

Edit the c:\windows\system32\drivers\etc\hosts file on each users machine and point those names to 192.168.1.111.

192.168.1.111 mylocalsite.com

Another solution

host your own local DNS server and bind your IP address to the URL.

Related