不能curl到NodeJS,但可以从浏览器访问它

我可以从浏览器访问我的testing节点站点( http://18.220.168.1:8888 )就好了。 但是,当我尝试使用PHP的cURLcurl时,我得到:

 Array ( [curl_error] => Failed to connect to 18.220.168.1 port 8888: Connection refused [error_number] => 7 ) 

我的cURL设置是:

 $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Temporary for testing self-signed sites curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: '.$data_type, 'Content-Length: ' . strlen($data), 'Public-Key: ' . $pub_key, 'Private-Key: ' . $priv_key, 'Authorization: Bearer ' . $pub_key,) ); $result = curl_exec($ch); 

我在亚马逊的EC2托pipe,端口是开放的(显然,因为我可以通过我的浏览器访问它)。 任何想法我在这里做错了偶然?

谢谢

编辑

我刚刚用resteasy的testing仪进行了testing,并且连接好了。 所以它必须是cURL请求或浏览器之间的东西。

我觉得很愚蠢 我刚刚意识到我是从安装了CSF的cPanel服务器执行此操作。 把这个端口添加到CSF之后,就起作用了。 我会留下来的,以免帮助其他脑屁的人。