Hi Nick,
I've followed your instructions to create a file and call it from the 'exec' node.
It seems to run, well it doesn't give any errors - just code:0, but it doesn't return a value.
Any further suggestions??
I think the main problem is that the php process running the command and the process executing scripts when you use a http request are not the same processes. Maybe it's "easier" to read the nginx configuration to determine the document_root.
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.