Guzzle’s POST request timing out from server (locally works)

  apache, guzzle, php, post, request

I’m trying to POST request my API, which is in a nginx server, from an apache server, but no response is obtained.
Requests from localhost to the same nginx server work fine. But, when the same snippet is executed in the production server, we get a time out, and Guzzle throws an exception after few seconds.

Exception threw:

<br />
<b>Fatal error</b>:  Uncaught GuzzleHttpExceptionConnectException: cURL error 7: Failed connect to; Connection timed out (see for in /var/www/html/
Stack trace:
#0 /var/www/html/ GuzzleHttpHandlerCurlFactory::createRejection(Object(GuzzleHttpHandlerEasyHandle), Array)
#1 /var/www/html/ GuzzleHttpHandlerCurlFactory::finishError(Object(GuzzleHttpHandlerCurlHandler), Object(GuzzleHttpHandlerEasyHandle), Object(GuzzleHttpHandlerCurlFactory))
#2 /var/www/html/ GuzzleHttpHandlerCurlFactory::finish(Object(GuzzleHttpHandlerCurlHandler), Object(GuzzleHttpHandlerEasyHandle), Objec in <b>/var/www/html/</b> on line <b>210</b><br />

Ping and Traceroute commands were executed and both of them succeded.

None of the machines have any firewall rule preventing any kind of communication between them.

This is the snippet that sends the request:

$base_url = "";
$url = $base_url . $rota;
$client = new Client([
    'headers' => ['Content-Type' => 'application/json;charset=utf-8']

$payload =  json_encode($data);

$response = $client->post($url, ['body' => $payload]);

PHP version: 7.4.20

Edit: Apache is listening the port 80 and Nginx is listening the port 8000, and both of them are up and running

Source: Ask PHP