How to setup a custom domain name in Lando?

| | 1 min read
Lando Drupal

We use Lando for all our local Drupal development. In some cases, we may want to set a particular domain name for our local Lando setup to use certain services which are tied up with the domain name.

By default, Lando uses lando-instance-name.lndo.site as the domain name to access the site created in Lando. If you want to use a different domain name instead of the default one, you can follow the below steps.

Add the following to your lando.yml file.

proxy:
  appserver:
    - yourdomain.com

Replace yourdomain.com with whatever name you want.

Rebuild your lando to reflect the above change in the lando.yml file if you are trying to change the domain name in an existing Lando instance.

lando rebuild

This step is not required for a new instance.

Finally, you have to add the following to your /etc/hosts file, to get your custom domain name to work in Lando.

127.0.0.1 yourdomain.com

The IP address of the local computer you are working on will be 127.0.0.1 by default. Replace yourdomain.com in the above with the domain name you set in the lando.yml file.

Now you should be able to access your Lando site with the domain name you set, from the browser even if you are offline.