Configuration

While Lando recipes set sane defaults so they work out of the box they are also configurable.

Here are the configuration options, set to the default values, for this recipe's Landofile. If you are unsure about where this goes or what this means we highly recommend scanning the recipes documentation to get a good handle on how the magicks work.

recipe: drupal9
config:
  php: '8.0'
  composer_version: '2.2.12'
  via: apache:2.4
  webroot: .
  database: mysql:5.7
  drush: false
  xdebug: false
  config:
    database: SEE BELOW
    php: SEE BELOW
    server: SEE BELOW
    vhosts: SEE BELOW

Note that if the above config options are not enough all Lando recipes can be further extended and overriden.

Choosing a Drupal version

If you've initialized a site with lando init there is a good chance this is already set correctly. However, definitely make sure you are vibing the correct major version of Drupal as the underlying server config differs.

recipe: drupal10|drupal9|drupal8|drupal7|drupal6
config:
  php: '7.4'

Choosing a PHP version

You can set php to any version that is available in our php service.

However, you should consult the Drupal requirementsopen in new window to make sure that the version of php you choose is actually supported by the version of drupal you are running.

Here is the recipe config to set the Drupal 9 recipe to use php version 7.4

recipe: drupal9
config:
  php: '7.4'

Choosing a composer version

You can set composer_version to any version that is available in our php service.

recipe: drupal9
config:
  composer_version: '1.10.1'

Choosing a webserver

By default this recipe will be served by the default version of our apache service but you can also switch this to use nginx. We highly recommend you check out both the apache and nginx services before you change the default via.

With Apache (default)

recipe: drupal9
config:
  via: apache

With nginx

recipe: drupal9
config:
  via: nginx

Choosing a database backend

By default this recipe will use the default version of our mysql service as the database backend but you can also switch this to use mariadb or postgres instead. Note that you can also specify a version as long as it is a version available for use with lando for either mysql, mariadb or postgres.

If you are unsure about how to configure the database we highly recommend you check out the mysql, mariadb and postgres services before you change the default.

Also note that like the configuration of the php version you should consult the Drupal requirementsopen in new window to make sure the database and version you select is actually supported by the version of Drupal you are using.

Using MySQL (default)

recipe: drupal9
config:
  database: mysql

Using MariaDB

recipe: drupal9
config:
  database: mariadb

Using Postgres

recipe: drupal9
config:
  database: postgres

Using a custom version

recipe: drupal9
config:
  database: mariadb:10.4

Connecting to your database

Lando will automatically set up a database with a user and password and also set an environment variables called LANDO INFO that contains useful information about how your application can access other Lando services.

Here is the default database connection information for a Drupal 9 site. Note that the host is not localhost but database. Also note that you will want to replace drupal9 if you are using a different major version of Drupal eg drupal8 for Drupal 8.

database: drupal9
username: drupal9
password: drupal9
host: database
# for mysql
port: 3306
# for postgres
# port: 5432

You can get also get the above information, and more, by using the lando info command.

Using custom config files

You may need to override our default Drupal configopen in new window with your own.

If you do this you must use files that exist inside your application and express them relative to your project root as below.

Note that the default files may change based on how you set both ssl and via. Also note that the vhosts and server config will be either for apache or nginx depending on how you set via. We highly recommend you check out both the apache and nginx if you plan to use a custom vhosts or server config.

A hypothetical project

Note that you can put your configuration files anywhere inside your application directory. We use a config directory in the below example but you can call it whatever you want such as .lando.

./
|-- config
   |-- default.conf
   |-- my-custom.cnf
   |-- php.ini
   |-- server.conf
|-- index.php
|-- .lando.yml

Landofile using custom drupal9 config

recipe: drupal9
config:
  config:
    database: config/my-custom.cnf
    php: config/php.ini
    server: config/server.conf
    vhosts: config/default.conf