Multisite NGINX configuration with subdomains

Hello,

I am stuck on configuring nginx with multisite. I have 2 sites one should be on example.com (main site) and 1 on sub.example.com. I successfully set up the installation on the main site - example.com and in the admin created new site configuration for sub.example.com as matching hostname. I then configured sub.example.com to use a reverse proxy in nginx to https://example.com but that just gives me 504 Gateway timeout default nginx error page.

The nginx config on the subdomain is like this:

location / {
proxy_pass https://example.com;
}

Is there some documentation on this or is someone able to provide a hint as to what I need to change in my config?

The main page works. It’s just the subdomain that does not.

Any help is appreciated. Thank you.