Apache is a web server that add parsers as modules (php).
NGINX is a reverse proxy/web server that can proxy to other processes listening on other ports. (PHP-FastCGI running on port 3000).
BROWSER -> NGINX (80) -> PHP-FastCGI (3000) -> NGINX -> BROWSER
NGINX can also proxy on sockets
BROWSER -> NGINX (80) -> PHP-FastCGI (/usr/socks/php.socks) -> NGINX -> BROWSER
CGI just defines the interface, and the language would be implementing the interface.