Score:0

Nginx/PHP-FPM Server often 521 error

cv flag

I have problem with my server since its ended up with 520/521 error. However, this only happen in a few seconds then its normal again. I have no idea where the problem is.

The SSH is running well, here is the uptime

15:25:52 up 10 days, 9:07, 2 users, load average: 2.17, 2.71, 2.98

This is my PHP-FPM settings

pm = ondemand
pm.max_children = 30
pm.start_servers = 0
pm.min_spare_servers = 1
pm.max_spare_servers = 5
pm.max_requests = 20
pm.process_idle_timeout = 10
request_terminate_timeout = 120s

I try to ping my domain

64 bytes from 172.67.161.114: icmp_seq=25 ttl=248 time=68.704 ms
64 bytes from 172.67.161.114: icmp_seq=26 ttl=248 time=22.861 ms
Request timeout for icmp_seq 32 => [THIS ONE]
64 bytes from 172.67.161.114: icmp_seq=33 ttl=248 time=23.103 ms
64 bytes from 172.67.161.114: icmp_seq=34 ttl=248 time=55.328 ms
64 bytes from 172.67.161.114: icmp_seq=35 ttl=248 time=49.159 ms
64 bytes from 172.67.161.114: icmp_seq=36 ttl=248 time=23.264 ms

I also try to ping my IP in the same time. However, it has no problem

64 bytes from 63.141.225.250: icmp_seq=112 ttl=45 time=236.596 ms
64 bytes from 63.141.225.250: icmp_seq=113 ttl=45 time=236.572 ms
64 bytes from 63.141.225.250: icmp_seq=114 ttl=45 time=257.145 ms
64 bytes from 63.141.225.250: icmp_seq=115 ttl=45 time=236.902 ms
64 bytes from 63.141.225.250: icmp_seq=118 ttl=45 time=237.004 ms
64 bytes from 63.141.225.250: icmp_seq=119 ttl=45 time=237.146 ms
64 bytes from 63.141.225.250: icmp_seq=120 ttl=45 time=274.892 ms
Score:0
kz flag

The server seems to be running fine, and the PHP-FPM settings are configured correctly. Therefore the issue might be related to the connectivity between your server and the Cloudflare network.

the 520/521 error can be a temporary issue that resolves on its own because of the connection between the origin server and the Cloudflare network.

In addition to that, you can check the Cloudflare status and use a tool like Pingdom or UptimeRobot to monitor your server's uptime and response time.

Stuart William avatar
cv flag
Is it only happened from client side? I thought it was about misconfigured with server which refuse to give response. I also check there is no firewall installed
jp flag
Could you provide your reasoning why do you think that the server is running fine even though it refuses connections as CloudFlare 521 error indicates?
Stuart William avatar
cv flag
The API is returning 521 code error. So, I test the homepage by reloading each 2s, sometimes it causes 521 error but while refreshed again. Its working.
Stuart William avatar
cv flag
Please check ping result, when I ping to domain, it gets one result timeout but then normal. Pinging to IP is totally normal without any timeout.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.