Tyk v2.2 Documentation Components

HomeTyk v2.2 Documentation ComponentsConfigure Tyk Gateway with Dashboard

Configure Tyk Gateway with Dashboard


This configuration assumes that you have already installed Tyk Dashboard, and have decided on the domain names for your dashboard and your portal. They must be different. For testing purposes, it is easiest to add hosts entries to your (and your servers) /etc/hosts file.

Set up Tyk

You can set up the core settings for Tyk Gateway with a single setup script, however for more involved deployments, you will want to provide your own configuration file. to get things running lets run:

sudo /opt/tyk-gateway/install/setup.sh --dashboard=http://YOUR-DASHBOARD_DOMAIN:3000 --listenport=8080 --redishost=localhost --redisport=6379 --domain=""

What we’ve done here is told the setup script that:

  • --dashboard=http://YOUR-DASHBOARD_DOMAIN:3000: We want to use the dashboard, since Tyk Gateway gets all it’s API Definitions from the dashboard service, we need to tell it where the dashboard is (this is very strict, it must match exactly the hostname and port you set for your dashboard).
  • --listenport=8080 Tyk should listen on port 8080 for API traffic
  • --redishost=localhost Use redis on the hostname: localhost
  • --redisport=6379 Use the default redis port
  • --domain="" Do not set a domain for the gateway, see the note on domains below for more about this

Pro Tip: Domains with Tyk Gateway

Tyk Gateway has full built in domain support, you can:

  • Set Tyk to listen only on a specific domain for all API traffic
  • Set an API to listen on a specific domain (e.g. api1.com, api2.com)
  • Split APIs over a domain using a path (e.g. api.com/api1, api.com/api2, moreapis.com/api1, moreapis.com/api2 etc.)
  • If you have set a hostname for the gateway, then all non-domain-bound APIs will be on this hostname + the listen_path

In this example, we don’t want Tyk to listen on a single domain, and we can always set up custom domains at the API level in the dashboard. It is recommended to leave the Tyk gateway domain unbounded for flexibility and ease of deployment.

Was this article helpful to you? Yes No