Friday, May 1, 2020

Error 502 Bad Gateway with Cloudflare and DigitalOcean server with Name.com registrar. My site doesn't work

I did some changes in configurations in these hours. Site still doesn't work.

My current configuration is:

  • Name.com: I put there the Cloudflare nameservers.
  • DigitalOcean panel: I made that the domain points to my server ip.
  • Cloudflare: says that I'm under cloudflare and that everything is ok, but it isn't, since if I connect to my site, it shows a 502 Bad Gateway. Pic: https://ibb.co/FXGbgMP

Also, if I go to domain setting in cloudflare, it says that my domain is not on cloudflare: https://ibb.co/1nKy37m

It doesn't have any sense... Cloudflare says everything is ok but then it tells me that my domain is not under Cloudflare..

If I `dig` my domain, the IPs returned are cloudflare ones, so it should be ok.

These are the last lines of the error log of nginx:

2020/05/01 12:43:41 [crit] 503#503: *115 connect() to unix:/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 162.158.111.11, server: MYSITEDOMAIN, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "MYSITEDOMAIN", referrer: "https://MYSITEDOMAIN/"

2020/05/01 12:44:05 [crit] 503#503: *117 connect() to unix:/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 162.158.111.197, server: MYSITEDOMAIN, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "www.MYSITEDOMAIN"

2020/05/01 12:44:23 [crit] 503#503: *120 connect() to unix:/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 162.158.111.11, server: MYSITEDOMAIN, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "MYSITEDOMAIN"

2020/05/01 12:52:24 [crit] 503#503: *126 connect() to unix:/run/php/php7.3-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 141.101.77.36, server: MYSITEDOMAIN, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.3-fpm.sock:", host: "MYSITEDOMAIN", referrer: "https://MYSITEDOMAIN/"

These are the last lines of nginx access.log (most of the IPs requesting my site are cloudflare IPs):

162.158.111.11 - - [01/May/2020:12:43:41 +0200] "GET / HTTP/1.1" 502 559 "https://MYSITEDOMAIN/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"

162.158.111.197 - - [01/May/2020:12:44:05 +0200] "GET / HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"

141.101.77.102 - - [01/May/2020:12:44:07 +0200] "GET /favicon.ico HTTP/1.1" 404 187 "https://www.MYSITEDOMAIN/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"

162.158.111.11 - - [01/May/2020:12:44:23 +0200] "GET / HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"

162.243.142.103 - - [01/May/2020:12:45:21 +0200] "GET /owa/auth/logon.aspx?url=https%3a%2f%2f1%2fecp%2f HTTP/1.1" 444 0 "-" "Mozilla/5.0 zgrab/0.x"

173.19.158.0 - - [01/May/2020:12:50:23 +0200] "POST /spywall/timeConfig.php HTTP/1.1" 400 157 "-" "XTC"

128.14.133.58 - - [01/May/2020:12:51:50 +0200] "GET / HTTP/1.1" 444 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36"

141.101.77.36 - - [01/May/2020:12:52:24 +0200] "GET / HTTP/1.1" 502 559 "https://MYSITEDOMAIN/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"

162.158.111.11 - - [01/May/2020:13:03:54 +0200] "GET / HTTP/1.1" 502 559 "https://MYSITEDOMAIN/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"

162.158.111.11 - - [01/May/2020:13:07:18 +0200] "GET / HTTP/1.1" 502 559 "https://MYSITEDOMAIN/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36"

This is `tcpdump -ni any port 53 | tee dns_problem.log` if this is useful:

12:42:48.003261 IP MYSERVERIP.33954 > 67.207.67.2.53: 16402+ AAAA? ams3.sonar.digitalocean.com. (45)

12:42:48.003593 IP MYSERVERIP.37054 > 67.207.67.2.53: 11556+ A? ams3.sonar.digitalocean.com. (45)

12:42:48.003973 IP 67.207.67.2.53 > MYSERVERIP.33954: 16402 0/1/0 (103)

12:42:48.003974 IP 67.207.67.2.53 > MYSERVERIP.37054: 11556 1/0/0 A 5.101.110.176 (61)

12:44:48.014388 IP MYSERVERIP.43089 > 67.207.67.2.53: 54807+ AAAA? ams3.sonar.digitalocean.com. (45)

12:44:48.014787 IP MYSERVERIP.39228 > 67.207.67.2.53: 49774+ A? ams3.sonar.digitalocean.com. (45)

12:44:48.015243 IP 67.207.67.2.53 > MYSERVERIP.39228: 49774 1/0/0 A 5.101.110.176 (61)

12:44:48.015245 IP 67.207.67.2.53 > MYSERVERIP.43089: 54807 0/1/0 (103)

12:46:48.021926 IP MYSERVERIP.48429 > 67.207.67.2.53: 21229+ AAAA? ams3.sonar.digitalocean.com. (45)

12:46:48.021995 IP MYSERVERIP.52767 > 67.207.67.2.53: 38688+ A? ams3.sonar.digitalocean.com. (45)

12:46:48.022608 IP 67.207.67.2.53 > MYSERVERIP.48429: 21229 0/1/0 (103)

12:46:48.022769 IP 67.207.67.2.53 > MYSERVERIP.52767: 38688 1/0/0 A 5.101.110.176 (61)

12:48:48.030531 IP MYSERVERIP.5607



No comments:

Post a Comment