At one point in time when creating my “stable” VPS, I thought I’d give Ubuntu-server a shot instead of CentOS or Debian, as it appears that many people are going the way of canonical now because of how concurrently stable and recent the packages are…. or something like that, who knows.

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

Turns out when you upgrade from the previous LTS (14.04) to 15.04 (at least I think that was what happened), some users will notice their php-based websites break, with sockets not being found in their nginx/apache logs. This is because the default unix listener (in /var/run/) changed from php5-fpm.sock to php-fpm.socket so all of a sudden you’ll get 502 bad gateways or 404’s, simply enough all you need to do is change your sites config file to reflect the new path

For me, this affected this blog (pretty big deal, right), I’m not much of a website person, and I’m fairly inexperienced with web servers, hence why I’m using the ever-so-easy, insecure mess that is wordpress. So this took me forever to figure out.

# vim /etc/nginx/sites-available/wordpress

I had to replace the fastcgi_pass directive that accepts a unix-domain or tcp socket here:

location ~ \.php$ {
 try_files $uri =404;
 fastcgi_split_path_info ^(.+\.php)(/.+)$;
 fastcgi_pass unix:/var/run/php-fpm.socket;
 fastcgi_index index.php;
 include fastcgi_params;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *