As a Web developer you often use a local webserver. You might create an own VHost for each project. The next step is to add a domain like mycustomer.local
with the IP 127.0.0.1. This is done by adding a line to your /etc/hosts file.
If you do not want to add a new entry each time you create a new project to /etc/hosts
, the is a simple way to add a wild card entry on Ubuntu.
This works, because current Ubuntu versions use the Network Manager which itself starts the local DNS server “dnsmasq”.
- Create a file
/etc/NetworkManager/dnsmasq.d
with the contents:
address=/.local/127.0.0.1
- Restart the network manager.
service network-manager restart - Check if everything went well
# host foobar.local
foobar.local has address 127.0.0.1