Ваші коментарі

Ajenti V mail is built upon Exim and Courier mail daemons.
I mean that you need following in custom MAIN website config: 
if ($host = 'sub.domain.com') { root /sub/domain/path; }
Look, you have put your PHP content entries in a main website, and now you created a separate website using custom configuration, without any dynamic content at all. Take a look at the generated .conf for better understanding. 
It's quite obvious - you made an empty static website pointing at a directory with .phps. Did you actually try to use a condition with alias setting inside instead of rewrite? You need to put that condition in the main website (which needs to be set up to listen at subdomain as well).
Unfortunately, there are still no EL7 packages of Courier.
Did you paste the code as-is? Because, "If the replacement string begins with http:// then the client will be redirected" (nginx manual). You can also try to replace rewrite with a custom root/alias path.
Totally possible:

if ($host = 'sub.domain.com') { rewrite / /subpath; }
Probably firewall (blocks port 8000 in clean CentOS) or wrong URL.