You are browsing documentation for an older version. See the latest documentation here.
Kong Configuration File
Kong Gateway comes with a default configuration file kong.conf
. If you installed Kong Gateway using an official package, this file can be found at /etc/kong/kong.conf.default
.
The Kong Gateway configuration file is a YAML file that can be used to configure individual properties of your Kong instance. This guide explains how to configure Kong Gateway using the kong.conf
file.
For all available parameters in kong.conf
, see the Configuration Parameter reference.
Configure Kong Gateway
To configure Kong Gateway, make a copy of the default configuration file:
cp /etc/kong/kong.conf.default /etc/kong/kong.conf
The file contains configuration properties and documentation:
#upstream_keepalive_pool_size = 60 # Sets the default size of the upstream
# keepalive connection pools.
# Upstream keepalive connection pools
# are segmented by the `dst ip/dst
# port/SNI` attributes of a connection.
# A value of `0` will disable upstream
# keepalive connections by default, forcing
# each upstream request to open a new
# connection.
To configure a property, uncomment it and modify the value:
upstream_keepalive_pool_size = 40
Boolean values can be specified as on
/off
or true
/false
:
#dns_no_sync = off # If enabled, then upon a cache-miss every
# request will trigger its own dns query.
# When disabled multiple requests for the
# same name/type will be synchronised to a
# single query.
Kong Gateway will use the default settings for any value in
kong.conf
that is commented out.
Verify configuration
To verify that your configuration is usable, use the check
command. The check
command will evaluate the environment variables you have
currently set, and will output an error if your settings are invalid.
kong check /etc/kong/kong.conf
If your configuration is valid the shell will output:
configuration at /etc/kong/kong.conf is valid
Set custom path
By default, Kong Gateway looks for kong.conf
in two
default locations:
/etc/kong/kong.conf
/etc/kong.conf
You can override this behavior by specifying a custom path for your
configuration file using the -c / --conf
argument in the CLI:
kong start --conf /path/to/kong.conf
Debug mode
You can use the Kong Gateway CLI in debug-mode to output configuration properties in the shell:
kong start -c /etc/kong.conf --vv
2016/08/11 14:53:36 [verbose] no config file found at /etc/kong.conf
2016/08/11 14:53:36 [verbose] no config file found at /etc/kong/kong.conf
2016/08/11 14:53:36 [debug] admin_listen = "0.0.0.0:8001"
2016/08/11 14:53:36 [debug] database = "postgres"
2016/08/11 14:53:36 [debug] log_level = "notice"
[...]