This post is linked with another post of mine (still unsolved):
Laravel - 作曲家更新:连接被拒绝 https://stackoverflow.com/questions/52404280/laravel-composer-update-connection-refused
但我正在就一个更具体的问题发表另一篇文章。
在 SSH 上的产品服务器(共享托管)上,我转到特定文件夹(其中包含我的网站):
$ cd /home/user/www/prod/
然后,如果我尝试:
$ curl https://larapack.io/packages.json
I get:
curl: (7) Failed to connect to larapack.io port 443: Connection refused
但如果我这样做:
$ curl https://packagist.org/packages.json
有用。
请注意,这两个文件都可以通过我的浏览器访问。
我在论坛上读过一些关于IPv6 or 防火墙, but:
I don't know if it could cause that
I can't find a proper way to check if both are disabled or not.
编辑:尝试其他事情......
看来这不是用户代理/引荐来源问题:(在 Windows 10 上尝试使用 chrome 65)
$ curl -A "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3315.4Safari/537.36" https://larapack.io/packages.json
curl: (7) Failed to connect to larapack.io port 443: Connection refused
看来这不是 IPV6 问题:(选项-4
强制使用 IPv4)
$ curl -4 https://larapack.io/packages.json
curl: (7) Failed to connect to larapack.io port 443: Connection refused
看来这不是 ssl 问题:(选项-k
跳过 ssl 的事情)
$ curl -k https://larapack.io/packages.json
curl: (7) Failed to connect to larapack.io port 443: Connection refused
看来这不是防火墙问题:我有一个包含有效指令的配置文件firewall=none
它不适用于wget
:
$ wget https://larapack.io/packages.json
pathconf: Value too large for defined data type
pathconf: Value too large for defined data type--2018-09-23 13:47:26-- https://larapack.io/packages.json
Resolving larapack.io (larapack.io)... 23.92.17.233
Connecting to larapack.io (larapack.io)|23.92.17.233|:443...
failed: Connection refused.
也不与nc
command(我没有 telnet 命令,但它的工作原理几乎相同,正如我所读到的)
$ nc larapack.io 443
larapack.io [23.92.17.233] 443 (https) : Connection refused
我尝试用 php 来卷曲,它有效!所以看来只能通过 SSH 来实现:
<?php
$url = "https://larapack.io/packages.json";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => $url
));
$resp = curl_exec($curl);
curl_close($curl);
echo $resp;