Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx. connect() to unix:/tmp/php.socket failed

Tags:

php

nginx

fastcgi

I am trying to setup nginx on my ubuntu vm and trying to host a php website. I am trying to replicate a server setup on my ubuntu vm. I am getting this error when i try to access the php page from my nginx server. I tried to look up for the php.socket file inside the /tmp/ folder but there's nothing in it. is there something wrong with fastcgi or php on my vm.

The complete error is as follows:

[crit] 9267#0: *1 connect() to unix:/tmp/php.socket failed (2: No such file or directory) while connecting to upstream, client: 192.168.xxx.xxx, server: xxx.xxx.xxx.com, request: "GET /admin/ HTTP/1.1", upstream: "fastcgi://unix:/tmp/php.socket:", host: "xxx.xxx.xxx..com"

please help. I dont know why is this happening am i missing a package or something. I have already got everything installed i guess and have got the same configurations on my local as server.

like image 586
maths Avatar asked Oct 20 '22 10:10

maths


1 Answers

Instead of using the unix socket, try to use the TCP\IP Connection:

location ~ .php$ { # fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_pass 127.0.0.1:9000; # ... }

This is for PHP5-FPM (which may be an alternative), maybe you have to use port 7777

like image 98
ralusnom Avatar answered Oct 23 '22 08:10

ralusnom