Configure App Domains and SSL

Who this is for

Users who want to expose their app under a custom domain name (e.g., api.mycompany.com) with HTTPS.


How App Domains Work

By default, an app is accessible via its host port on the server's IP address (e.g., http://server-ip:8080). To serve the app at a proper domain over HTTPS, you add a domain to the app. CloudAIPilot:

  1. Creates an Nginx reverse proxy vhost for the domain, forwarding to the app's container port.
  2. Optionally provisions a Let's Encrypt SSL certificate.

Prerequisites

  • App is running.
  • You own a domain and can edit its DNS records.
  • The domain's A record is already pointing to the server's IP address (see KB-03-03: Domain and DNS).

How to Add a Domain to an App

  1. Open the app detail → Domains tab.
  2. Click + Add Domain.
  3. Fill in:
FieldDescriptionRequired
DomainThe domain or subdomain (e.g., api.mycompany.com)Yes
Target portFor compose apps: the host port to proxy toRequired for compose apps
Target serviceFor compose apps: the service nameOptional
  1. Click Add.

CloudAIPilot creates an Nginx vhost and reloads Nginx.


How to Issue SSL for a Domain

After adding the domain:

  1. In the Domains tab, find the domain row.
  2. Click Issue SSL.
  3. CloudAIPilot runs Certbot for the domain.
  4. The domain status updates to active (SSL provisioned) after success.

Prerequisite: DNS must already be propagated. SSL provisioning fails if the domain does not resolve to the server.


Domain Status Values

StatusMeaning
pendingSSL issuance in progress
activeSSL is valid and configured
expiredCertificate has expired
noneNo SSL — HTTP only

How to Remove a Domain

  1. In the Domains tab, click Delete (trash icon) on the domain row.
  2. CloudAIPilot removes the Nginx vhost (best-effort — if the vhost file removal fails, it does not block the delete).

Compose Apps: Target Port Requirement

For compose apps with multiple services, you must specify which host port the domain should proxy to. Each service can have its own domain pointing to a different host port.

Example:

  • app.mycompany.com → target port 8080 (web service)
  • api.mycompany.com → target port 3000 (API service)

What Success Looks Like

Visiting https://yourdomain.com in a browser shows the app running behind HTTPS. The domain row in CloudAIPilot shows SSL status active.


Common Issues and Fixes

IssueLikely causeFix
"DOMAIN_CONFLICT"Domain already used by another app or siteRemove it from the other resource first.
"INVALID_TARGET_PORT"Port specified doesn't match any mapped portVerify the host port in Port Mapping matches.
"SSL_IN_PROGRESS"Another SSL job is running for this domainWait and retry.
Nginx shows 502 Bad GatewayApp not running or wrong target portVerify app is running and target port is correct.

Related Articles