Question

502 Gateway Error on nginx Running a Laravel App

I’m reaching out to see if anyone out there might be able to offer a little insight into an odd issue one of my sites is encountering.

I set up a Laravel project on a Droplet (1GB Ram 30GB SSD Disk New York 3 Ubuntu 14.04 x64). The Droplet is running several sites under a few subdomains.

At 6 PM EST two days ago we started throwing 502 bad gateway response on one of the Laravel sites. All the other subdomains on that Droplet appeared to be working as expected.

I created a new Droplet and moved the offending Laravel project to it. It’s 2GB Ram 40GB SSD Disk same OS. At 7 PM EST yesterday we started throwing 502 bad gateway again on the new Droplet.

In both cases running “service php5-fpm restart” seemed to resolve the issue. Network traffic and CPU consumption were relatively low and dropped off when we started throwing errors, Memory consumption jumped slightly.

I’m reaching out to you to see if anyone has experienced anything similar and if there is a solution out there.

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello,

It sounds like that your PHP-FPM service is crashing. This is most likely due to out of memory.

I would recommend adjusting your PHP memory limit so that it is not too high and maybe also adding some more RAM.

You could also check your access logs and make sure that there’s no malicious activity going on.

Finally what you could do is optimize your site so that it uses fewer resources.

Regards, Bobby

This comment has been deleted