Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.
Your new vhost config fails.
It should have been a copy of the working config (only adding TLS).
But it fails, so I can only assume the copy is bad or incomplete.
There must be a difference between the working config and the failing config.
I don’t understand your request.
The problem appears to be in your coding.
This is not a PHP, nor NGINX, programming forum.
You should review the code and fix it or search the web for coding help to fix it or maybe there is another forum that can help you fix it.