Setting Up Custom Domain
For users that want to bring their own domain for their CVM.
Last updated
Was this helpful?
For users that want to bring their own domain for their CVM.
Last updated
Was this helpful?
If you prefer video content, check the YouTube tutorial here.
Have access to the Cloudflare account with API token
If you have not generated an API Token for your custom domain management then follow these steps:
For this deployment example, we will be an nginx
application where the dstack-ingress
container that will forward traffic the TARGET_ENDPOINT
that points to the nginx
application with an exposed port 80
. It is important to know that this can change based on how your docker app's compose file is configured.
Now on to the deployment. Go to you Phala Cloud Dashboard and deploy a new CVM. Select docker-compose.yml option for deployment then take the past the docker compose file below into the Advanced tab of the CVM configration page.
Explanation of environment variables:
CLOUDFLARE_API_TOKEN
: Your Cloudflare API token
DOMAIN
: Your custom domain (i.e. your-domain.com
)
GATEWAY_DOMAIN
: The dstack gateway domain. (e.g. _.dstack-prod5.phala.network
for Phala Cloud prod5 server)
CERTBOT_EMAIL
: Your email address used for Let's Encrypt email notifications
TARGET_ENDPOINT
: Where the ingress should forward all incoming traffic—i.e. the upstream service application:port. In this case, we point to the nginx
app on port 80
.
SET_CAA
: Set to true
to enable CAA record setup
Now copy and paste the docker-compose.yaml code above into the Advanced Tab similar to the screnshot below.
Next you need to grab your Cloudflare API Token for your domain, and fill in your environment variables. For this example, deploy to prod5 ( domain:dstack-prod5.phala.network
).
Congratulations! You've successfully deployed your CVM with a custom domain. Your application is now secured with Zero Trust HTTPS, thanks to the seamless integration of Cloudflare DNS and Let's Encrypt. If you are interested in the verification of this process check the Domain Attestation and Verification.
Now you have the knowledge base on the custom domain deployment with a basic nginx dstack application. The features you have used to enable your custom domain are defined below:
Automatic SSL certificate provisioning and renewal via Let's Encrypt
Cloudflare DNS configuration for CNAME, TXT, and CAA records
Nginx reverse proxy to route traffic to your application
Certificate evidence generation for verification
The dstack-ingress system provides mechanisms to verify and attest that your custom domain endpoint is secure and properly configured. This comprehensive verification approach ensures the integrity and authenticity of your application.
When certificates are issued or renewed, the system automatically generates a set of cryptographically linked evidence files:
Access Evidence Files:
Evidence files are accessible at https://your-domain.com/evidences/
Key files include acme-account.json
, cert.pem
, sha256sum.txt
, and quote.json
Verification Chain:
quote.json
contains a TDX quote with the SHA-256 digest of sha256sum.txt
embedded in the report_data field
sha256sum.txt
contains cryptographic checksums of both acme-account.json
and cert.pem
When the TDX quote is verified, it cryptographically proves the integrity of the entire evidence chain
Certificate Authentication:
acme-account.json
contains the ACME account credentials used to request certificates
When combined with the CAA DNS record, this provides evidence that certificates can only be requested from within this specific TEE application
cert.pem
is the Let's Encrypt certificate currently serving your custom domain
If you've enabled CAA records (SET_CAA=true
), you can verify that only authorized Certificate Authorities can issue certificates for your domain:
The output will display CAA records that restrict certificate issuance exclusively to Let's Encrypt with your specific account URI, providing an additional layer of security.
All Let's Encrypt certificates are logged in public Certificate Transparency (CT) logs, enabling independent verification:
CT Log Verification:
Confirm that the certificates match those issued by the dstack-ingress system
This public logging ensures that all certificates are visible and can be monitored for unauthorized issuance
Host your domain on
For more details, checkout the for the dstack-ingress dstack examples.
Click Create button and your CVM will deploy in a couple minutes with the custom domain. Here is an example of a custom domain deployed to
You can check the example of the deployment at .
Visit and search for your domain