'nginx -t' exists as a general syntax checker, would be neat to expand it further to include these in depth checks.
e.g.
set $upstream_app backend;
set $upstream_port 8888;
set $upstream_proto http;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;