My issue: I get the 502 error once in a day for 15 minutes and then the website starts working fine.
How I encountered the problem: I’ve recently switched to a DDos protected ip and after this switch ive constantly faced this issue
Solutions I’ve tried: I’ve tried nothing for now since I don’t have much knowledge about this, but I’ve made sure that the port 80 and 443 are always open
Version of NGINX or NGINX adjacent software (e.g. NGINX Gateway Fabric): nginx/1.28.0
Deployment environment: Ubuntu
Minimal NGINX config to reproduce your issue (preferably running on playground for ease of debugging, and if not as a code block):(Tip → Run nginx -T to print your entire NGINX config to your terminal.) https://tech-playground.com/snippet/just-thoughtful-basilisk/
Based on your comment about this having only started after enabling a DDoS service, I think it’s safe to assume that this is not an NGINX issue.
I went through the logs you shared and the issue seems to be with accessing your index file within NGINX. My sneaking suspicion is that the way you have configured either NGINX or your environment or your DDoS service is making it seem as if those internal redirects to/requests to access your index file come from DDoS attack and the DDoS service is blocking the file/preventing the file from being read.
Thanks for looking into this, but the machine on which I host my website was constantly overloading and hence the nginx error. I’ve upgraded the machine and it works fine now.