In my case, nginx does not have access to my php-fpm.sock path.
You can check nginx error log using this:
tail -f /var/log/nginx/error.log
normally nginx error.log is located here:
/var/log/nginx
So using this command you can give php-fpm access to nginx (in my case it looks like this)
sudo chown username:nginx /opt/cpanel/ea-php80/root/usr/var/run/php-fpm/ac2f1a1c01ab7cd98f10650b49bc3c9b0fa24bb7.sock