Bash/ZSH: Find out the exit codes of all piped commands

A shell pipe is a way to connect the output of one program to the input of another program without any temporary file. How do I get exit status of process that’s piped to another (for e.g. ‘netstat -tulpn | grep nginx’) on a Linux or Unix-like system using a bash shell?