Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
please, you can share the solution, what are the files that you need change? ty. Excuse me my english.
First of all, I’m not too familiar with Nginx as a reverse cache, but the configuration seems pretty straight forward.
Seems like you’re caching all requests for 8 minutes in fastcgi_cache_valid, which will cache a 500-error for that entire time. You’re also caching all 500-error responses for 2 seconds in Nginx. I’m a little unsure why you’re doing that, but I suspect it’s to let the server recover or something?
I bet you’re running out of PHP processes, which makes requests time out, giving you a 502 Bad Gateway or 500 Internal Server Error. This is then cached, and served up for the next 8 minutes according to fastcgi_cache_valid. Restarting and deleting the Nginx cache will naturally solve this.
Proposed solution, which will only cache requests that has returned 200 OK:
fastcgi_cache_valid any 8m;
fastcgi_cache_valid 200 8m;