nginx and php-fpm configuration errors

Moving an nginx install from Ubuntu 14.04 to 18.04 and upgrading to more recent versions of nginx, php, php-fpm, I ran into this error in my nginx config:

2020/02/28 04:45:47 [crit] 11784#11784: *1 connect() to unix:/var/run/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.x.x, server: , request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php7.2-fpm.sock:", host: "10.x.x.x"

The “No such file or directory” error is talking about the nginx connection to the php7.2-fpm.sock, rather than the file the GET request is for.

On closer look at where the .sock file is located, this was a subtle error to find and fix, but the fix was simple as I was pointing to the wrong path.

In my nginx default config, I had this line (migrating from a config for an older nginx and pphp-fpm version, this is where it was before):

fastcgi_pass unix:/var/run/php7.2-fpm.sock;

… I was missing a /php/ dir in the path, so changing to the correct path was the fix:

fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;

awk basics

I’ve tinkered with awk and sed for quick one off tasks before in the past but I always have to go back and check the syntax for awk as it’s one of those things I use only once in a while.

Some quick notes for reference for later:

  • awk splits records in an input file by default by white space chars
  • uses $0 to refer to a whole line, and $1 … $n to refer to each matching token on a line
  • to split using column delimiters other than whitespace use -F


Example file – example1.txt:

aaa bbb ccc
ddd eee fff

$ awk {'print $1'} example1.txt

Will print the first matching column:


If file has other column delimiters use -F to specify the delimiter, for example, example2.txt:


$ awk -F , {'print $2'} example2.txt

Will match column 2:


More info on awk here.

Raspbian error: “The following signatures couldn’t be verified because the public key is not available”

I couldn’t do a ‘sudo apt-get update’ on my Pi 3 running Raspbian as I got this error:

Fetched 74.9 kB in 31s (2,381 B/s)                            Reading package lists... Done
W: GPG error: jessie/updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9D6D8F6BC857C906 NO_PUBKEY AA8E81B4331F7F50

To import the missing keys:

sudo apt-key adv –keyserver –recv-key AA8E81B4331F7F50

sudo apt-key adv –keyserver –recv-key 9D6D8F6BC857C906

Tips from here.