reverse-proxying from nginx to a tor onion is such a pain, the best method is probably using socat as in https://docs.btcpayserver.org/Deployment/ReverseProxyToTor/ but it's annoying to have another moving part to manage
alternatively there's an 8-year-old nginx module, https://github.com/dannote/socks-nginx-module, that adds direct socks proxy support, but using it, as i understand, requires patching and recompiling nginx
another option i've found is a http proxy for onions that nginx can use directly, https://github.com/termermc/tor-reverse-proxy/ but like the first option it's another process to keep running, and it's in server-side javascript ☹️