Install and Configure PHP-FPM - Need Assistance

Hi Team,

Need some assistance on this task.

I tried multiple time but , im not able to figure it out.

This time i tried only on one server just to troubleshoot the issue. but im still getting the below errors.

Steps which ive performed.

Copied the file to /data directory .
installed nginx and php-fpm

under /etc/nginx/nginx.conf made these changes
image

under /etc/php-fpm.d/www.conf
made these changes
image

Any suggestions or document to be referred to getting this fixed will be helpful. was trying this out for a week but no luck for me.

Waiting for some guidance to get this fixed.

Attaching the errors i see on the logs

020/03/20 17:39:32 [crit] 1293#0: *9 connect() to unix:/var/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 172.16.238.14, server: 172.16.238.10, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php-fpm/php-fpm.sock:”, host: “2886795270-80-kitek06d.environments.katacoda.com”, referrer: “https://2886795270-kitek06d.environments.katacoda.com/
2020/03/20 17:39:32 [error] 1293#0: *9 open() “/var/www/html/50x.html” failed (2: No such file or directory), client: 172.16.238.14, server: 172.16.238.10, request: “GET / HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php-fpm/php-fpm.sock”, host: “2886795270-80-kitek06d.environments.katacoda.com”, referrer: “https://2886795270-kitek06d.environments.katacoda.com/

Hi,
In the php-fpm config you missed two things
First, you must change the listen parameters to the process name not the IP adress : /var/run/fpm…
The one that you put on the fastcgi_pass

Second, the owner and group must by nginx to give nginx the right privileges

Hi,

Thanks for responding.

I tried making the change as mentioned but i’m getting 502 Bad gateway error while accessing.

But when i try curl command from the server i get 200 response.

Can you confirm is this correct or not?

image

/html>[root@stapp03 nginx]# tail -500f access.log
172.16.238.12 - - [20/Mar/2020:19:11:34 +0000] “GET / HTTP/1.1” 200 130 “-”“curl/7.29.0” “-”
172.16.238.12 - - [20/Mar/2020:19:11:45 +0000] “GET / HTTP/1.1” 200 130 “-”“curl/7.29.0” “-”