Can't have Wordpress websites to work with nginx on subdomain, connect() to unix:/run/php/php7.2-fpm.sock failed error

Hello, I’m using a droplet to run a couple of static websites, each on their own domains, like:

and so on.

Then, I use the same droplet to test other websites (mainly Wordpress sites), using subdomains this way:


For each of these I added an A record on the dns records management section in the DigitalOcean admin and then a nginx configuration file for each website like this one:

server {
        root /var/www/
        index index.php index.html index.htm;


        location / {
                try_files $uri $uri/ /index.php?q=$uri&$args;

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;

        location ~ \.php$ {
              include snippets/fastcgi-php.conf;
              include fastcgi_params;
              fastcgi_pass unix:/run/php/php7.2-fpm.sock;
              fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name;
              fastcgi_param PHP_VALUE post_max_size=20M;
              fastcgi_param PHP_VALUE upload_max_filesize=20M;

When trying to access the url I get an error 404. In the logs there’s this:

2019/02/10 18:26:47 [crit] 9914#9914: *30 connect() to unix:/run/php/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream, client:, server:, request: “GET /favicon.ico HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.2-fpm.sock:”, host: “” 2019/02/10 18:26:47 [error] 9914#9914: *30 open() “/usr/share/nginx/html/50x.html” failed (2: No such file or directory), client:, server:, request: “GET /favicon.ico HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.2-fpm.sock”, host: “

I’m not sure what to do. The thing is that till a couple of days ago this setup was actually working. What I did was upgrading the certbot. In doing so I might’ve broken something without realizing it.

Thanks for your help.

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer


It’s possible php-fpm isn’t started up. Try this. Locate the php-fpm service like this:

systemctl|grep php-fpm

Then start it up:

systemctl start php7.2-fpm

Replace php7.2-fpm with the actual service name from the systemctl listing.


Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel