I have created few subdomains for my domain like api.example.com, dev.example.com and www.example.com. For every subdomain i created an virtualhost in Nginx. But now the problem is when i visit a domain which does not exist it should be redirected to www.example.com. But this is not the exist instead i am getting an error page that the sub domain does not have an secure connection. Since i am using Let's Encrypt i get this message all the time for sub domains which is incorrect. I contacted my DNS provider and they told me your settings are correct you have to correct your webserver configuration. They added a CNAME.
Now i do not know how to add this in my nginx configuration. So i hope someone can help me fixing my issue regarding my subdomains.
thanks in advance.