502 error during Wordpress installation on nginx

December 17, 2018 788 views
Nginx WordPress Ubuntu 18.04

Hi all,

I am getting a 502 error when trying to access the Wordpress installer (index.php).

My error log says (replaced my domain name with mydomain.com):

2018/12/17 21:04:30 [crit] 5239#5239: *29 connect() to unix:/var/run/php-fpm/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream, client:, server: mydomain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php7.2-fpm.sock:", host: "mydomain.com", referrer: "http://mydomain.com" 

when I check my server this file does not exist, I have php-fpm but no .sock file

 $locate php-fpm

my question:

  1. How do I resolve this 502 error?
  2. What is the socket file (and do I create it myself or should it be automatically generated?

Many thanks

1 Answer

Hey friend,

The easiest answer is that PHP-FPM is not started, where the more difficult answer is that it isn’t configured to listen in the same way that Nginx is configured to connect to it. If it’s the first one, run this:

systemctl start php-fpm7.2

If that doesn’t work, this may:

systemctl start php-fpm

If it’s not that, I would refer back to the guide you are using to configure this and make sure that you’ve followed all of the steps.


Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!