Hey all. I'm having trouble hosting my appwrite function domain. First, I already registered a domain say, example.com, and I have configured wildcard ssl certificate and wildcard domain to host my appwrite on this example.domain (appwrite.example.com), and I also configured nginx to proxy_pass appwrite.example.com to localhost. I also changed _APP_DOMAIN_FUNCTIONS in .env to appwrite.example.com. Everything works fine until I deploy a function and a random function ID is assigned to the appwrie.example.com domain. It seems that I have to configure wildcard * to appwrite.example.com. And, the domain section in the function section doesnt have a CNAME.
#[SOLVED] Sefl-hosted appwrite function domain
30 messages · Page 1 of 1 (latest)
and how to setup wildcard domain for deployed functions in nginx so it can pass to appwrite on localhost ?
The function domain should be different than your main domain
Like functions.example.com. then, you'll need to make sure *.functions.example.com points to appwrite.example.com using a cname record.
Then, configure nginx to forward the traffic
Thanks for your quick response. I guess I missed configuring appwrite function domain. _APP_DOMAIN_FUNCTIONS must have functions subdomain on top of backend.example.com right ?
it already points to the IP of my server, when I run nslookup function_id.backend.example.com, it returns the IP of my server
Hmm okay so maybe something is wrong with nginx. Does the main Appwrite domain work?
yeap. It works perfectly. I already configured wildcard ssl and can visit via https://appwrite.my_domain.com
Okay what's the nginx config for both domains?
This is my domain config in namecheap
and this is the nginx block for my appwrite
do I need to add a .function.backend.my_domain.com to nginx ?
Wait what about nslookup function_id.functions.backend.example.com?
Of course
You need a config that points *.functions.example.com to your Appwrite instance
And you might need another ssl cert too
Still point to the server’s ip
Yeap. But the proxy_pass is still http://localhost:9000 or it might be another value? I’m not clear about this
Same value as your main Appwrite domain
I tried that. the https://function_id.backend.my_domain.com display the content of the main page https://my_domain.com
You mean it shows your Appwrite console?
nope. Another webpage I hosted on https://my_domain.com . Appwrite console is on https://backend.my_domain.com
Do you have a sample nginx configuration in case? I read some threads on appwrite supports already but it doesn't work from my understanding Lol
What's your nginx config?
I use nginx proxy manager because I don't want to deal with nginx configs 😅
wait can you make your function domain env var different from your main domain env var?
but also, your nginx config should just be something like:
server_name *.functions.example.com backend.example.com;
Hi @glass quail , thank you so much for your support. I figured out my problem. I didn't create a new txt record for my wildcard *.backend.my_domain.com. Initially I used ssl cerf from letsencrypt for wildcard at the fist level *.my_domain.com for the second level subdomain, and ssl cerf from letsencrypt only works for a single wildcard domain.
so all good now? Can this be marked as solved?
Yeap