1

I have a webserver configured to accept FastCGI requests at 127.0.0.1:9000 like below.

/etc/php5/fpm/pool.d/www.conf:

listen = 127.0.0.1:9000

/etc/nginx/sites-enabled/mysite:

location ~ .php$ 
{
    if (!-e $request_filename) 
    {
        rewrite / /index.php last;
    }

    expires  off;
    fastcgi_pass  127.0.0.1:9000;
    fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param MAGE_RUN_CODE $mage_code;
    fastcgi_param MAGE_RUN_TYPE $mage_type;
    include fastcgi_params;
}

However, I'm looking at the Nginx error log, I keep getting this error:

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

What could be causing this error? This socket file is not available on this server.

Note: When I do $ sudo grep -r unix:/var/run/php5-fpm.sock /etc/nginx:

/etc/nginx/sites-available/mysite.20160330:    fastcgi_pass  unix:/var/run/php5-fpm.sock;
/etc/nginx/sites-available/mysite.20160330:    fastcgi_pass  unix:/var/run/php5-fpm.sock;
/etc/nginx/sites-available/default:            #fastcgi_pass unix:/var/run/php5-fpm.sock;
/etc/nginx/sites-available/mysite:             #fastcgi_pass  unix:/var/run/php5-fpm.sock;
/etc/nginx/sites-available/mysite:             #fastcgi_pass  unix:/var/run/php5-fpm.sock;    
laketuna
  • 125
  • 9
  • Can you run this command `grep -r unix:/var/run/php5-fpm.sock /etc/nginx` and let me know the output. – Peter May 15 '16 at 00:45
  • updated the main post with the output. – laketuna May 15 '16 at 00:48
  • Ok, I would comment out the lines `/etc/nginx/sites-available/mysite.20160330: fastcgi_pass unix:/var/run/php5-fpm.sock; /etc/nginx/sites-available/mysite.20160330: fastcgi_pass unix:/var/run/php5-fpm.sock;` . Then try systemctl restart nginx and test to see if you still get error – Peter May 15 '16 at 00:50
  • Do those get loaded even though the file names have been altered? – laketuna May 15 '16 at 00:51
  • Not 100% sure but I believe so; quickest way to tell would be to comment out and test. – Peter May 15 '16 at 00:52
  • Commented them out in the `.20160330` file and restarted nginx/php5-fpm. i'll look out for that error. – laketuna May 15 '16 at 00:54
  • If you have a symlink from `/etc/nginx/sites-enabled` pointing to the `/etc/nginx/sites-available/mysite.20160330` file, then the configuration is loaded. If you want to disable a site configuration, you should remove the symlink from `/etc/nginx/sites-enabled`. On another note, I prefer Unix domain sockets to TCP sockets, because the over of opening a TCP socket is bigger than opening an UNIX socket. – Tero Kilkanen May 15 '16 at 02:12

0 Answers0