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

screwtape_mk's avatar

Laravel Herd 502 Bad Gateway

I had already solved this after multiple back and forths, by changing php versions and back to whatever version seems to have resolved this but its back again and this time that doesn't solve it.

I have been experiencing issues with a Laravel application running on Herd, specifically encountering a 502 Bad Gateway error. After some troubleshooting, the issue seems to be related to PHP-FPM (FastCGI Process Manager) and potential conflicts with port usage or configuration.

I've attempted to resolve the issue by checking and restarting Nginx and PHP-FPM services, verifying PHP versions, and editing configuration files (e.g., www.conf) to adjust port settings. I've also tried to determine the PHP version being used by Herd for my Laravel application. Despite these efforts, the issue persists. Any suggestions

0 likes
3 replies
screwtape_mk's avatar

when i look at the nginx logs i get :

2025/05/25 00:19:11 [emerg] 58970#221144: bind() to 127.0.0.1:80 failed (48: Address already in use) 2025/05/25 00:19:11 [emerg] 58970#221144: bind() to 127.0.0.1:80 failed (48: Address already in use) 2025/05/25 00:19:11 [emerg] 58970#221144: bind() to 127.0.0.1:80 failed (48: Address already in use) 2025/05/25 00:19:11 [emerg] 58970#221144: bind() to 127.0.0.1:80 failed (48: Address already in use) 2025/05/25 00:19:11 [emerg] 58970#221144: bind() to 127.0.0.1:80 failed (48: Address already in use) 2025/05/25 00:19:11 [emerg] 58970#221144: still could not bind()

screwtape_mk's avatar

Ok I had to kill the processes that were running on that port and then create a link using herd link myapplication

I have a different type of error now which is a db connection

screwtape_mk's avatar

It has been fixed, i just needed to restart mysql even from DBngin UI

Please or to participate in this conversation.