1

Firstly, I ran nginx -t and it did not give me any error. I then tried to check error.log file

I ran this command tail -30 /var/log/nginx/error.log, and after reading the error I discovered a wrong path unix:/run/php/php7.0-fpm.sock. I don't use php7.0 I use php7.2 What I should do to correct this path?

I already tried to remove php7.0 completely by command apt-get purge php7.0 but I still got 502 Bad Gateway. The error I got from tail -30 /var/log/nginx/error.log

2020/03/05 12:21:15 [crit] 1073#1073: *65 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.241.218.89, server: 45.76.203.111, request: "GET /ReportServer HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "45.76.203.111"
2020/03/05 12:23:12 [crit] 1073#1073: *70 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 35.231.52.19, server: unigates.com, request: "GET / HTTP/1.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:24:36 [crit] 1073#1073: *75 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 35.231.52.19, server: unigates.com, request: "GET / HTTP/1.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "www.unigates.com"
2020/03/05 12:34:30 [crit] 1073#1073: *83 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 51.36.64.136, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:34:48 [crit] 1073#1073: *86 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 207.46.13.53, server: unigates.com, request: "GET /profile/jeddah-international-college HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:36:37 [crit] 1073#1073: *89 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 123.125.71.85, server: unigates.com, request: "GET /profile/emirates-academy-of-hospitality-management HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "www.unigates.com"
2020/03/05 12:41:38 [crit] 1073#1073: *92 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:43:56 [crit] 1073#1073: *95 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 37.9.113.92, server: unigates.com, request: "GET /program/search?category=6 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:44:17 [warn] 1013#1013: server name "https://unigates.com$request_uri" has suspicious symbols in /etc/nginx/sites-enabled/unigates.com:59
2020/03/05 12:44:17 [warn] 1036#1036: server name "https://unigates.com$request_uri" has suspicious symbols in /etc/nginx/sites-enabled/unigates.com:59
2020/03/05 12:44:22 [crit] 1044#1044: *1 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:44:42 [crit] 1044#1044: *4 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 141.8.132.36, server: unigates.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:44:49 [crit] 1044#1044: *1 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:45:42 [crit] 1044#1044: *1 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:45:44 [crit] 1044#1044: *1 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:52:12 [crit] 1044#1044: *10 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:54:13 [crit] 1044#1044: *10 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 12:54:15 [crit] 1044#1044: *10 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 13:00:32 [warn] 5348#5348: server name "https://unigates.com$request_uri" has suspicious symbols in /etc/nginx/sites-enabled/unigates.com:59
2020/03/05 13:11:08 [crit] 1044#1044: *17 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 46.229.168.144, server: unigates.com, request: "GET /program/14 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 13:11:16 [crit] 1044#1044: *19 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 13:23:03 [crit] 1044#1044: *26 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 95.163.255.179, server: 45.76.203.111, request: "GET /program/1 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "ww38.unigates.com"
2020/03/05 13:53:55 [crit] 1044#1044: *31 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 54.36.148.225, server: unigates.com, request: "GET /program/search?page=4 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "demo.unigates.com"
2020/03/05 14:00:13 [crit] 1044#1044: *34 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 46.229.168.131, server: unigates.com, request: "GET /register HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 14:13:33 [crit] 1044#1044: *38 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 14:14:05 [crit] 1044#1044: *38 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 14:15:45 [crit] 1043#1043: *1 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 197.37.0.193, server: unigates.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 14:32:47 [crit] 1043#1043: *6 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 46.229.168.146, server: unigates.com, request: "GET /program/27 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "www.unigates.com"
2020/03/05 14:36:09 [crit] 1043#1043: *8 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 157.55.39.60, server: unigates.com, request: "GET /program/11 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"
2020/03/05 14:48:16 [crit] 1043#1043: *10 connect() to unix:/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 42.242.10.165, server: unigates.com, request: "GET /program/search?category=3 HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "unigates.com"

..and when I checked the nginx service status systemctl status nginx I got "Active, running" and these 3 lines.

Mar 05 15:32:55 unigates systemd[1]: Stopped A high performance web server and a reverse proxy server.
Mar 05 15:32:55 unigates systemd[1]: Starting A high performance web server and a reverse proxy server...
Mar 05 15:32:55 unigates systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Mar 05 15:32:55 unigates systemd[1]: Started A high performance web server and a reverse proxy server.

Please assist.

1 Answer 1

1

I solved the problem by configuring this file sudo nano /etc/nginx/sites-available/default then change this line form

fastcgi_pass unix:/run/php/php7.0-fpm.sock;

to

fastcgi_pass unix:/run/php/php7.2-fpm.sock;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .