Skip to content

Kong API Gateway Configuration

Both kong and kong-migration read .kong.env. The file controls listeners, database access, logging, and TLS files.

The current environment file defines every variable below. Keep KONG_PG_PASSWORD secret and restrict access to the certificate private key mounted at /var/ssl/key.pem.

Variable Default Value Explanation
KONG_PROXY_ACCESS_LOG /dev/stdout Where to output the access logs for proxy requests. Forwarded to stdout for Docker logging.
KONG_ADMIN_ACCESS_LOG /dev/stdout Where to output the access logs for the Admin API.
KONG_PROXY_ERROR_LOG /dev/stderr Where to output the error logs for proxy requests. Forwarded to stderr for Docker logging.
KONG_ADMIN_ERROR_LOG /dev/stderr Where to output the error logs for the Admin API.
KONG_ADMIN_LISTEN "0.0.0.0:8001, 0.0.0.0:8444 ssl" The ports and interfaces Kong listens on for the Admin API.
KONG_ADMIN_GUI_LISTEN "0.0.0.0:8002, 0.0.0.0:8445 ssl" The ports and interfaces Kong listens on for the Kong Manager GUI.
KONG_ADMIN_GUI_PATH "/manager" The URL path to access the Kong Manager GUI.
KONG_DATABASE postgres Specifies that Kong should use a PostgreSQL database for its configuration store.
KONG_PG_HOST kong-postgres The hostname of the Kong Postgres database container.
KONG_PG_DATABASE kong The name of the database Kong will use.
KONG_PG_USER kong The database user Kong will connect as.
KONG_PG_PASSWORD <KONG_DB_PASSWORD> Secret. Must match POSTGRES_PASSWORD in .kong-postgres.env.
KONG_NGINX_HTTP_SSL_CERTIFICATE /var/ssl/cert.pem Path to the SSL certificate for proxy HTTPS traffic.
KONG_NGINX_HTTP_SSL_CERTIFICATE_KEY /var/ssl/key.pem Path to the SSL certificate key for proxy HTTPS traffic.
KONG_ADMIN_SSL_CERT /var/ssl/cert.pem Path to the SSL certificate for the Admin API HTTPS traffic.
KONG_ADMIN_SSL_CERT_KEY /var/ssl/key.pem Path to the SSL certificate key for the Admin API HTTPS traffic.
KONG_ADMIN_GUI_SSL_CERT /var/ssl/cert.pem Path to the SSL certificate for the Kong Manager GUI.
KONG_ADMIN_GUI_SSL_CERT_KEY /var/ssl/key.pem Path to the SSL certificate key for the Kong Manager GUI.