Getting value of DOCUMENT_ROOT from PHP

I'm not an nginx expert either but maybe you could analyse the sites-enabled directory of your nginx server? I believe the root is defined in one of those files there. On my ubuntu test machine it's /etc/nginx/sites-enabled. You can use the command whereis nginx to get the directories you are looking for.

Edit: Or you could still use the http request approach but instead of returning the absolute path, you are writing it into a file on your server (which only you know, the file I mean) and then read the content of that file from Node-RED.