502 Bad Gateway Nginx – Ubuntu

Image

This is the second time this is happening to me so i am doing this post as documentation for myself and to help others as well.
I use webmin/usermin on ubuntu to create a new server(host) and the other sites start showing ‘502 Bad Gateway’.
I look at the config files and every thing looks okay. Folder/file permissions are as expected.
I check the server logs and voila! nginx is looking for a file: /var/run/php5-fpm.sock. For some reason, the file was not in /var/run. Continue reading