Error 502 Bad Gateway on Nginx

I have a Wordpress blog running on Nginx.
Everything was working fine, but since from few days it started to return the error 502 Bad Gateway nginx/1.22.1

When I access the website on the browser I receive this error, then I wait some seconds and refresh the page and everything works.
I think that there is some issue during the “machine wake up”

Recents logs show:

2024-05-26 21:22:50.138 [416.847012] reboot: Restarting system
2024-05-26 21:22:50.138 WARN could not unmount /rootfs: EINVAL: Invalid argument
2024-05-26 21:22:49.386 ERROR error umounting /var/www/html: EBUSY: Device or resource busy, retrying in a bit
2024-05-26 21:22:48.634 ERROR error umounting /var/www/html: EBUSY: Device or resource busy, retrying in a bit
2024-05-26 21:22:47.881 ERROR error umounting /var/www/html: EBUSY: Device or resource busy, retrying in a bit
2024-05-26 21:22:47.138 2024/05/26 19:22:47 INFO SSH listening listen_address=[fdaa:7:f8d4:a7b:170:ced4:d456:2]:22 dns_server=[fdaa::3]:53
2024-05-26 21:22:47.131 [26-May-2024 19:22:47] NOTICE: exiting, bye-bye!
2024-05-26 21:22:47.131 [26-May-2024 19:22:47] NOTICE: Terminating ...
2024-05-26 21:22:47.130 WARN hallpass exited, pid: 328, status: signal: 15 (SIGTERM)
2024-05-26 21:22:47.130 ERROR error umounting /var/www/html: EBUSY: Device or resource busy, retrying in a bit
2024-05-26 21:22:47.129 INFO Umounting /dev/vdd from /var/www/html
2024-05-26 21:22:47.123 INFO Starting clean up.
2024-05-26 21:22:47.109 INFO Main child exited with signal (with signal 'SIGTERM', core dumped? false)
2024-05-26 21:22:46.226 INFO Sending signal SIGTERM to main child process w/ PID 327

Hi,

Do you have your machines set to auto turn on/off, in the fly.toml ? That is the default and of course is cheaper (since you aren’t paying for an idle machine) but … it looks like it can cause issues. This post is about Laravel however the symptoms sound similar:

It might be worth (at least temporarily) keeping a minimum of 1 machine alive to confirm.

I added sleep 1 to my Dockerfile entrypoint script. Not beautiful but is working.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.