EatSleepCode
EatSleepCode

Reputation: 462

Nginx Error is Resulting in 502 Bad Gateway

I have an AWS EC2 instance which is running Ubuntu. When I go into my error logs I have this one right here. What does this mean and how can I fix it?

This is from my error.log file:

2019/09/05 18:01:02 [crit] 991#991: *46 connect() to unix:/var/run/php/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 64.223.223.8, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.2-fpm.sock:", host: "thewildwear.com"

Upvotes: 0

Views: 739

Answers (1)

Adiii
Adiii

Reputation: 59976

Your Nginx server not able to communicate with php7.2-fpm either the path /var/run/php/php7.2-fpm.sock is not valid or the php7.2-fpm is not running.

Check if PHP is running.

sudo systemctl status php7.2-fpm

verify the path if it existls -l /var/run/php/php7.2-fpm.sock

If not exist then try to find the exact file under php cd /var/run/php/ and ls you will see

php7.*-fpm.pid  php7.*-fpm.sock

update the /etc/nginx/sites-available/default and changed "fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;" line to "fastcgi_pass unix:/var/run/php/php7.{after ls}-fpm.sock;".

You can check this GitHub issue and here.

Upvotes: 2

Related Questions