On my VPS, I leverage CloudPanel to oversee multiple sites, including one that runs Docker and uses Appwrite as its source.
However, using CloudPanel means dealing with Nginx, which proxies traffic for different websites. This setup made it a bit tricky to assign a custom domain to an Appwrite project.
The basic process involves adding your domain in the Project > Settings > Custom Domain section and pointing the CNAME to your main Appwrite domain. Simple enough, right? But here's the hitch: Appwrite can't issue an SSL certificate via Let's Encrypt for this domain because it fails the verification.
The solution –
- First, make sure the
CNAME
is correctly set up for your domain. - Go to CloudPanel, select your domain, and click on
VHOST/Nginx
. - Add the secondary domain in the server block right next to the main domain, separated by a comma, then save your changes.
- Head over to the
SSL/TLS
tab. - If there's an existing LE certificate, Delete it.
- Click on
Actions
and chooseNew LE Cert
. - Enter both your main Appwrite domain and the custom domain you want to use for the certificate.
- Click on 'Create and Install'.
- Done! Now both domains have a valid SSL certificate.
Note: If Appwrite indicates an SSL Certificate Failure, don't worry. It's marked as failed because the verification attempt by the worker was unsuccessful.