NGINX: connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory)



PHP Snippet 1:

sudo apt-get install php7.2-fpm
sudo service nginx restart
sudo service php7.2-fpm restart

PHP Snippet 2:

apt-get purge php7.3-fpm
rm -rf /etc/php/7.3/fpm/
apt-get install php7.3-fpm
service nginx restart
service php7.3-fpm restart

PHP Snippet 3:

 e.g `php7.4` 

PHP Snippet 4:

/etc/init.d/php7.2-fpm restart

PHP Snippet 5:

server {
        listen 80;
        root /var/www/html;
        index index.php index.html index.htm index.nginx-debian.html;
        server_name example.com;

        location / {
                try_files $uri $uri/ =404;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        }

        location ~ /\.ht {
                deny all;
        }
}