Overview
This guide shows you how to connect an API gateway in front of 3 different applications using NGINX, a lightweight web server capable of handling thousands of requests per second.
Prerequisites
- At least one application created in Qovery
- Ideally three applications (billing API, core API, messaging API), though one application is sufficient to follow this tutorial
Step 1: Fork the API Gateway Template
Fork the NGINX gateway repository:routes.conf.template. Forks created before November 20, 2026 also need the updates described in Keep NGINX Up to Date.
Step 2: Edit routes.conf.template
Replace the content ofroutes.conf.template with your routes. Each UPPERCASE $NAME is a backend you define in Step 4:
Important Notes:
- Rules apply in order: the first match wins
- The gateway talks to the backends over HTTP on the internal network
- Clients reach the gateway over HTTPS
- Complex path patterns are supported
routes.conf.template with the environment variable of the same name. Lowercase NGINX variables such as $request_uri are left as is.
- A short service name, such as the value of a
QOVERY_..._HOST_INTERNALvariable, is completed with the namespace domain, and the port is read from the DNS SRV record of the service. - If the service exposes several ports, set
<NAME>_PORT(for exampleCORE_BACKEND_PORT=8080). - A value with a dot or a port (
api.example.com,api.example.com:8443) is used as is.
Step 3: Create API Gateway App in Qovery
Create a new application in Qovery with the following settings:- Build mode: Dockerfile
- Port: 80
Step 4: Configure Environment Variables
Create one environment variable alias per backend used inroutes.conf.template, with ENVIRONMENT scope:
Finding the Correct Environment Variables
To find the right environment variable for each service:- Access the target application in the Qovery Console
- Extract the application ID from the URL:
- Take the first segment of the ID:
082e36c4 - Prepend āZā and switch to uppercase:
Z082E36C4 - Search for environment variables containing this prefix
The variable you need is
QOVERY_APPLICATION_Z082E36C4_HOST_INTERNAL (QOVERY_CONTAINER_..._HOST_INTERNAL for a container service).Step 5: Set Up Custom Domain
Add a custom domain to expose the gateway with your chosen domain name. Navigate to your API gateway application settings and configure your custom domain.Step 6: Deploy
- Commit your changes to the
routes.conf.templatefile - Push to your repository
- Deploy the application from the Qovery Console
GENERATED ROUTES.CONF markers. Each Qovery service backend should resolve to <service>.<namespace>.svc.cluster.local:<port>. A backend set to a host with a dot (such as api.example.com) stays as you configured it.
Keep NGINX Up to Date
Your fork does not receive the fixes made to the template. Follow the NGINX security advisories and update theFROM nginx:... line of your Dockerfile when a new version is out. The template enables Dependabot, which opens a pull request on your fork when a new image is published.
Forks created before November 20, 2026 run NGINX 1.21.5. Update them to 1.30.7 or later, and copy the new run.sh from the template.
Next Steps
NGINX Gateway Repository
View the template repository with example configurations
Application Configuration
Learn more about configuring applications on Qovery
Environment Variables
Detailed guide on managing environment variables
Custom Domains
Configure custom domains for your applications