Skip to content

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.

yaml
recipe: lemp
config:
  php: '7.4'
  composer_version: '2.2.12'
  webroot: .
  database: mysql:5.7
  xdebug: false
  config:
    server: SEE BELOW
    php: SEE BELOW
    database: 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 php version

You can set php to any version that is available in our php service. However, you should make sure that whatever framework or custom code you write is designed to work with your choice.

The recipe config to set the LEMP recipe to use php version 5.3 is shown below:

yaml
recipe: lemp
config:
  php: '5.3'

Choosing a composer version

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

yaml
recipe: lemp
config:
  composer_version: '1.10.1'

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, mariadband 'postgres' services before you change the default.

Using MySQL (default)

yaml
recipe: lemp
config:
  database: mysql

Using MariaDB

yaml
recipe: lemp
config:
  database: mariadb

Using Postgres

yaml
recipe: lemp
config:
  database: postgres

Using a custom version

yaml
recipe: lemp
config:
  database: postgres:9.6

Connecting to your database

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

The default database connection information for a LEMP site is shown below:

Note that the host is not localhost but database.

yaml
database: lemp
username: lemp
password: lemp
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 LEMP config 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 shown 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 explicitly for apache. We highly recommend you check out the apache 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.

bash
./
|-- config
   |-- default-ssl.conf
   |-- httpd.conf
   |-- my-custom.cnf
   |-- php.ini
|-- index.php
|-- .lando.yml

Landofile using custom lemp config

yaml
recipe: lemp
config:
  config:
    database: config/my-custom.cnf
    php: config/php.ini
    server: config/httpd.conf
    vhosts: config/default-ssl.conf