Skip to main content
When self-hosting Meilisearch, you can configure your instance at launch with command-line options, environment variables, or a configuration file. These startup options affect your entire Meilisearch instance, not just a single index. For settings that affect search within a single index, see index settings.

Configuration methods

Meilisearch supports three configuration methods. When used simultaneously, command-line options take the highest precedence, followed by environment variables, and finally the configuration file.

Command-line options and flags

Pass command-line options and their respective values when launching a Meilisearch instance:
./meilisearch --db-path ./meilifiles --http-addr 'localhost:7700'
Meilisearch also has command-line flags that don’t take values. If a flag is given, it activates and changes default behavior:
./meilisearch --no-analytics
All command-line options and flags are prepended with --. They take precedence over environment variables.

Environment variables

Set environment variables prior to launching the instance:
export MEILI_DB_PATH=./meilifiles
export MEILI_HTTP_ADDR=localhost:7700
./meilisearch
Environment variables for flags accept n, no, f, false, off, and 0 as false. An absent environment variable is also considered false. Any other value is considered true. Environment variables are always identical to the corresponding command-line option, but prepended with MEILI_ and written in all uppercase.

Configuration file

Meilisearch accepts a configuration file in .toml format. Configuration files can be easily shared, versioned, and allow you to define multiple options. Download a default configuration file:
curl https://raw.githubusercontent.com/meilisearch/meilisearch/latest/config.toml > config.toml
By default, Meilisearch looks for a config.toml file in the working directory. You can override this with the MEILI_CONFIG_FILE_PATH environment variable or the --config-file-path CLI option:
./meilisearch --config-file-path="./config.toml"
In configuration files, options must be written in snake case. For example, --import-dump would be written as import_dump.
Specifying the config_file_path option within the configuration file will throw an error.

Configuring cloud-hosted instances

To configure Meilisearch with command-line options in a cloud-hosted instance, edit its service file. The default location of the service file is /etc/systemd/system/meilisearch.service. To configure Meilisearch with environment variables in a cloud-hosted instance, modify Meilisearch’s env file. Its default location is /var/opt/meilisearch/env. After editing your configuration options, relaunch the Meilisearch service:
systemctl restart meilisearch
Meilisearch Cloud offers an optimal pre-configured environment. You do not need to use any of the configuration options listed here when hosting your project on Meilisearch Cloud.

Next steps

Configuration reference

Complete list of all instance configuration options.

Index settings

Configure search behavior for individual indexes.