Nextcloud install trouble when installing. NGINX+cloudflare+certbot

Hello, I have been trying to set up nextcloud on a home server proxied with cloudflare using NGINX and certbot SSL but I have not been able to get past a 502 bad gateway error after finishing installation(now navingating to installation results in a donwloaded index.php). I never got to the login screen. The error started showing up on the “apps” section of installation and now I get the 502 error everywhere. I have it set to be on a subdomain virtual host in nginx and it was working with a plain phpinfo file before install so that isn’t the problem. I’ve also turned off all cloudflare protection and the rocket stuff and no change. Here is my nginx file for the subdomain. Any help is appreciated! thank you

Bump. Still having issues.