Configuration
RoadRunner supports both YAML and JSON configuration formats. The examples in our documentation use YAML, but you can use JSON as well.
To convert a YAML configuration file to JSON, you can use an online tool such as https://onlineyamltools.com/convert-yaml-to-json.
Configuration reference
The most recent configuration reference with all available options can be found in the .rr.yaml
file in the RoadRunner GitHub repository:
We use dots as level separators, e.g.: http.pool
, you can't use dots in section names, queue names, etc. You can find out more about it here.
Configuration file
The RoadRunner looks for a configuration file named .rr.yaml
in the same directory as the server binary.
If your configuration file and other application files are located in a different directory than the binary, you can use the -w
option to specify the working directory.
You can also use the -c
option to specify the path to the configuration file if you don't want to specify the working directory.
Or you can combine the -c
and -w
options to specify both the configuration file and the working directory:
Read more about starting the server in the Server Commands section.
CLI command and arguments
You can also use environment variables in CLI commands to customize the behavior of your RR server. This is especially useful when you need to pass configuration values that are environment-specific or sensitive, such as secrets or API keys.
The set -a
enables automatic exporting of variables. Any variables that are defined in /var/www/config/.env
will be automatically exported to the environment, making them available to any child processes that are executed from the current shell. The final set +a
command disables automatic exporting of variables, ensuring that only the variables that were defined in /var/www/config/.env
are exported, and preventing any unintended variables from leaking into the environment.
In this example, the following options are used:
Option | Description |
---|---|
-c | Specifies the configuration file. |
-w | Specifies the working directory. |
-o | Overwrites specific configuration options. |
/var/www/config/.env | File that contains the required environment variables. |
${RR_NUM_WORKERS:-8} | Sets the number of workers to |
Support for the nested configurations: [>=2024.2.0]
, issue
[>=2024.2.0]
, issueUsing the following syntax, you may include other configuration files into the main one:
Starting from version v2024.2.0
, the includes
configuration option no longer has restrictions on where the included config can be placed. However, please note that the path for the included configurations is calculated based on the working directory of the RoadRunner process.
Includes override the main configuration file. For example, if you have the following nested configuration:
It will override the server
and http
sections of the main configuration file. You may use env variables in the included configuration files, but you can't use overrides for the nested configuration. For example:
The next 'include' will override values set by the previous 'include'. Values in the root .rr.yaml
will also be overwritten by the includes. Feel free to send us feedback on this feature.
You may use any number of the included configuration files via CLI command, in quotas and separated by whitespace. For example:
What's Next?
Server Commands - learn how to start the server.
PHP Workers β Environment variables - learn how to configure PHP workers environment.
Config plugin - learn more about the Config plugin.
Last updated