Proxy public ip to private server page not found error

First time user. I have nextcloud running nicely on a server on my lan. Everything seems to be working nicely. I’m trying to set it up for access from the outside world. I have a debian box that acts as my router and firewall. I installed nginx on it and am trying to set up proxy-passing to access the next-cloud server. I want to do this instead of a port forward as I have a jitsi-meet server running on a different server I use for testing for work, and I would like to be able to access both from the outside world. What I have is
WAN IP -> nginx proxy -> 10.0.0.39 where 10.0.0.39 is my nextcloud server. When I try to access it from the outside world, the nextcloud background loads with an error saying the the resource could not be found with a link to the login page, which just reloads the resource could not be found page. my nginx configuration looks like

 location ~ ^/nextcloud/(.*)$ {
                proxy_pass http://10.0.0.39/nextcloud/$1;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_redirect http://10.0.0.39/nextcloud/$1 http://xxx.xxx.xxx.xxx/nextcloud/nextcloud/$1;
        }

where xxx.xxx.xxx.xxx is my wan ip. I removed the // from the http because I could not post otherwise. I don’t have a host name right now, but I think this is ok since I am just using this for storing my research and pictures and stuff, and not using it for much else. I think the problem is with my proxy, but I’m not sure where. I would appreciate it if someone could point me in the right direction. Thanks

I put the slashes back and put it in coding-tags.

The doubled nextcloud-folder in proxy_redirect is probably a typo? From the manual it should be ok to set it to (https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect):

proxy_redirect http://10.0.0.39/nextcloud/ http://xxx.xxx.xxx.xxx/nextcloud/;

or even just the domain (without subfolder).

Thanks. Just got to look at this again after a busy last week of the semester. I thought I had that originally and it didn’t work. Put it to that, and now it works, so maybe I had a typo earlier.