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

roseriyadh's avatar

Forge Laravel nginx error

Good day, I'm having this error

2023/04/20 11:07:44 [error] 28555#28555: *170 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: , server: , request: "POST /api/y HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.2-fpm.sock:", host: ""

and shows

<html>

<head>
	<title>502 Bad Gateway</title>
</head>

<body>
	<center>
		<h1>502 Bad Gateway</h1>
	</center>
	<hr>
	<center>nginx</center>
</body>

</html>

and it's a fresh server, I even made requests on it to test it and now when I try to access its APIs I get this message, but when i access the web version (laravel home page) it shows normally. what can I do to stop it?

I'm using the following packages in my code so nothing unusual:

laravel/sail ................................................................................ DONE
  laravel/sanctum ............................................................................. DONE
  laravel/tinker .............................................................................. DONE
  nesbot/carbon ............................................................................... DONE
  nunomaduro/collision ........................................................................ DONE
  nunomaduro/termwind ......................................................................... DONE
  spatie/laravel-ignition ..................................................................... DONE

AFTER THE HELP OF LARRY: I checked the file of /var/log/php8.2-fpm.log I found the following error:

[20-Apr-2023 11:20:09] WARNING: [pool www] child 28673 exited on signal 11 (SIGSEGV - core dumped) after 745.387800 sec>

AFTER RUNNING dmesg | grep segfault | tail -10 :

7f86220c4000+195000]
[37071.640541] php-fpm8.2[28377]: segfault at 7ffffbcffff8 ip 00007f86221d2702 sp 00007ffffbd00000 error 6 in libc.so.6[7f86220c4000+195000]
[37093.805641] php-fpm8.2[28563]: segfault at 7ffcdb310ff8 ip 000056173f8d52cc sp 00007ffcdb311000 error 6 in php-fpm8.2[56173f73f000+310000]
[37212.642877] php-fpm8.2[28564]: segfault at 7ffcdb310ff8 ip 000056173f8d52cc sp 00007ffcdb311000 error 6 in php-fpm8.2[56173f73f000+310000]
[37958.084382] php-fpm8.2[28673]: segfault at 7ffcdb310ff8 ip 000056173f8d52cc sp 00007ffcdb311000 error 6 in php-fpm8.2[56173f73f000+310000]

So please, help

0 likes
3 replies
roseriyadh's avatar
roseriyadh
OP
Best Answer
Level 3

I could solve it by tracing the code I have made and I saw that I made a mistake by calling cache when it's not used. Hope this helps

Please or to participate in this conversation.