You need to set up a DNS server. (install dnsmasq (is light) or bind (is rather heavy)). To install...
Ubuntu OS:
sudo apt-get install dnsmasq
In /etc/NetworkManager/dnsmasq.d/dnsmasq-localhost.conf
and
address=/localhost.com/127.0.0.1
restart
sudo /etc/init.d/dnsmasq restart
with Mac OS:
Install dnsmasq
brew update # Always update Homebrew and the formulae first
brew install dnsmasq
sudo brew services start dnsmasq
sudo brew services start dnsmasq
Configure dnsmasq
Its default configuration file is located at /usr/local/etc/dnsmasq.conf and contains examples of its most prominent features. Open that file and add this line all the way at the bottom:
conf-dir=/usr/local/etc/dnsmasq.d,*.conf
This will instruct dnsmasq to include all files that end with .conf in the /usr/local/etc/dnsmasq.d directory as additional configuration files. This way we can keep our custom configuration better organised. Make sure the directory exists and create our first config file:
mkdir -p /usr/local/etc/dnsmasq.d touch
/usr/local/etc/dnsmasq.d/development.conf
and add this to conff
address=/localhost.com/127.0.0.1
restart
sudo brew services restart dnsmasq