So after lots of testing I think I’ve found the best CLI commands to find and kill errant Apache and nginx processes
#Show all Apache and nginx processes.
lsof -i | grep LISTEN | grep 'nginx\|httpd'
alias http-listen="lsof -i | grep LISTEN | grep 'nginx\|httpd'"
#Kill all Apache and nginx processes.
lsof -i | grep LISTEN | grep 'nginx\|httpd' | awk '{print $2}' | xargs -n 1 kill
alias http-kill="lsof -i | grep LISTEN | grep 'nginx\|httpd' | awk '{print \$2}' | xargs -n 1 kill"
#Identify processes using network
lsof -tnPi | xargs -n 1 ps -p
I have provided the terminal command as well as the command for an alias if that’s your thing.