Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

robgoodliffe's avatar

502 Bad Gateway

I've been using forge servers to test my development sites and have woke up to a 502 Bad Gateway to all my sites. I haven't messes around on the server/command line once. Just linked my github account and added a few environment variables. I started using forge because I wanted something that would just work out of the box and I wouldn't have to worry about dealing with these problems.

Could anybody give me a clue as to why this could have happened.

Thanks

0 likes
15 replies
robgoodliffe's avatar

Thanks for the links chaps. Much appreciated. I haven't personally updated anything on forge, but I'll have a dig around on the forge server. This is exactly what i didn't want to do with forge, I just needed it to work.

robgoodliffe's avatar

OK, my bad. It was simply a case of running out of disk space on the server. A quick upgrade and the problem is solved.

2 likes
fireproofsocks's avatar

Having the same problem here... rebooting had no effect. There's plenty of space on the server -- it's totally new.

I'm seeing the following in my nginx error logs:

2014/10/27 16:07:24 [error] 1489#0: *2 connect() failed (111: Connection refused) while
connecting to upstream, client: 64.145.76.159, server: myserver.com, request: "GET 
/index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "myserver.com"

I'm really confused on how Forge is setting up the server instance. What's missing here? This is all new, and nothing works out of the box.... the deploy script tried to access directories that didn't exist, and the config here seems like it's referencing things somewhere that aren't correct.

Anyone have ideas?

1 like
brandonschatz's avatar

I had this problem today where my laravel installation was working, but all other sites returned 502 Bad Gateway.

I restarted the server, didn't fix the problem.

I restarted nginx manually: sudo /etc/init.d/nginx restart didn't work

I restarted php5-fpm manuall: sudo /etc/init.d/php5-fpm restart didn't work

Then I restarted hhvm: sudo /etc/init.d/hhvm restart It worked.

Not sure why this was having a problem. It was working like a champ for quite a while. I hope this helps anyone that is having this odd issue.

2 likes
secstar1223's avatar

@[email protected] Thanks, I was struggled with this "502 Bad Gateway" in my nginx sever. I solved this problem by reading the article you posted. I was run this command:

sudo apt install php-fpm

sudo systemctl restart nginx

Sever was running well.

azimidev's avatar

I just restarted everything:

  • Server
  • php
  • mysql
  • nginx

I pushed something and i didn't get any 502 error anymore

aacook's avatar

This happened to me just now. Rebooting nginx didn't work. Rebooting the entire server did work.

CueTracker's avatar

Sorry to dig up an old thread, but I just had this too. About 300 or so users on the site so shouldn't be that bad.

Restarting PHP did nothing, restarting the server did nothing, then restarting MySQL worked.

Any more tips for debugging this would be welcome, it seems odd to me that restarting the server as a whole, which should include MySQL didn't work, but just MySQL did.

Error: connect() to unix:/var/run/php/php7.3-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream

freskimveliu's avatar

For me restarting MySQL fixed the problem. I actually figure out putting the app down by executing the command: php artisan down ,then the app worked ( it returned under maintenance view).

Please or to participate in this conversation.