Just an initial thought, I'm sure you know nginx will not do a great deal with a php file on its own, unless you've set up eg FastCGI somewhere for nginx to connect to.
Out of interest, what brought you to choose nginx over, say, Apache? It's not to say it's a great tool, it just sounds like messing with configs (ie to say, getting others to write them for you) might not be quite what you're looking for at the moment. Regardless...
For 1) I would set up a server block which catches all, sticks it in a regex and looks for the site directory:
Code:
server {
server_name ~^(www\.)?(?<domain>.+)$;
location / {
root /path/to/$domain;
index index.html index.php;
...
}
}
2) If there's no test.php it's going to return as a 404 anyway...
3) For all server blocks/for each domain - rather ambiguous - are you wanting to serve up exactly the same error page across all domains? If so take a look at
error_page in nginx wiki, there are a couple of solutions you could use.