Managing Wildcard Subdomains in Laravel Homestead on Ubuntu

Imagine the scenario where you have multiple subdomains, such as multiple locales for the internalization of your application served as and; you don't need to put each of them as a seperate entry to your both homestead config file and the hosts file if all of them will be served from the same application. There is of course an easier way. 

Let's assume our application is located within the ~/Code/Example folder and we want to map it to, furthermore, the ip address assigned to our box is
$ nano ~/Homestead/Homestead.yaml
The most simple Homestead config will be like below.
ip: ""
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/

- ~/.ssh/id_rsa

- map: ~/Code/Example
to: /home/vagrant/Code/Example

- map:
to: /home/vagrant/Code/Example/public

- homestead
Then, ssh into your vagrant box and edit the nginx.conf of the
$ cd ~/Homestead && vagrant up && vagrant ssh
$ sudo nano /etc/nginx/sites-available/
And just add the wildcard entry to the server_name.
server_name *
And reload the nginx configuration.
$ sudo service nginx reload
$ exit
Then on your local machine, add a dnsmasq entry.
$ sudo nano /etc/NetworkManager/dnsmasq.d/local
Just add the entry below.
Finally, restart the network-manager.
$ sudo service network-manager restart
Now everything should be ok. You don't need to add individual entries for each of the subdomains of your application. For instance, both and will be served without adding a seperate configuration for each.