2019-08-13 02:14
浏览 204

AWS Amazon Server:cURL错误无法解析主机

I've been using a fanless ubuntu server for a couple of months and been transferred my Laravel API Passport to different servers like Ubuntu and for development Windows.

The current version of my api is working fine on these servers. Not until when I transferred the laravel project to my AWS Amazon server and getting the error like this

"message": "cURL error 6: Could not resolve host: api-a.mydomain.comoauth (see",
"exception": "GuzzleHttp\\Exception\\ConnectException",
"file": "/var/www/html/api_tk_a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php",
"line": 185,
"trace": [
   ....some line of multiple errors


I tried to add some line of code to my etc/hosts file

like this

52.***.***.205 52.***.***.205


tried also my inet addr:171.*.**.** to put on my hosts file still getting the same error

I have 2 different api that's why there's a and b

But nothing of these works.

Can anyone point out the reason why I'm getting this error.

Some thread says this has nothing to do with the Guzzle but clearly states to the IP and DNS. But I can't find a good way to figure this out.


My .env file has something like this


I tried to put the APP_URL as still not working..

API CODE This code is working fine

$http = new Client;
        $response = $http->post(url('oauth/token'), [
            'form_params' => [
            'grant_type' => 'password',
            'client_id' => '2',
            'client_secret' => '8mEsN0RZkljKZlbiJFfnNKahcbcOVkoQVG7C2Xwl',
            'username' => $user->email,
            'password' => $request->password,
            'scope' => '',

This is my routes/api.php

use Illuminate\Http\Request;

EC2 Ping

enter image description here

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • doushun1904 2019-08-15 03:00

    I found a solution:

    I used $http->post('' . '/oauth/token', [

    Laravel passport trying to get oauth/token. Guzzle keeps hanging, also on other Guzzle calls

    解决 无用
    打赏 举报
  • 查看更多回答(1条)

相关推荐 更多相似问题