![ubuntu下为什么不能把http改成https?](https://linux22.com/image/195041/ubuntu%E4%B8%8B%E4%B8%BA%E4%BB%80%E4%B9%88%E4%B8%8D%E8%83%BD%E6%8A%8Ahttp%E6%94%B9%E6%88%90https%EF%BC%9F.png)
ubuntu下为什么不能把http改成https?
Err:1 https://ports.ubuntu.com/ubuntu-ports focal InRelease
Could not connect to ports.ubuntu.com:443 (91.189.91.38). - connect (111: Connection refused) Could not connect to ports.ubuntu.com:443 (91.189.91.39). - connect (111: Connection refused)
Err:2 https://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Unable to connect to ports.ubuntu.com:https:
Err:3 https://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Unable to connect to ports.ubuntu.com:https:
Err:4 https://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Unable to connect to ports.ubuntu.com:https:
Reading package lists... Done
W: Failed to fetch https://ports.ubuntu.com/ubuntu-ports/dists/focal/InRelease Could not connect to ports.ubuntu.com:443 (91.189.91.38). - connect (111: Connection refused) Could not connect to ports.ubuntu.com:443 (91.189.91.39). - con
nect (111: Connection refused)
W: Failed to fetch https://ports.ubuntu.com/ubuntu-ports/dists/focal-updates/InRelease Unable to connect to ports.ubuntu.com:https:
W: Failed to fetch https://ports.ubuntu.com/ubuntu-ports/dists/focal-backports/InRelease Unable to connect to ports.ubuntu.com:https:
W: Failed to fetch https://ports.ubuntu.com/ubuntu-ports/dists/focal-security/InRelease Unable to connect to ports.ubuntu.com:https:
W: Some index files failed to download. They have been ignored, or old ones used instead.
Err:1 https://ports.ubuntu.com/ubuntu-ports focal InRelease
Could not connect to ports.ubuntu.com:443 (91.189.91.39). - connect (111: Connection refused) Could not connect to ports.ubuntu.com:443 (91.189.91.38). - connect (111: Connection refused)
Err:2 https://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Unable to connect to ports.ubuntu.com:https:
Err:3 https://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Unable to connect to ports.ubuntu.com:https:
Err:4 https://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Unable to connect to ports.ubuntu.com:https:
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
W: Failed to fetch https://ports.ubuntu.com/ubuntu-ports/dists/focal/InRelease Could not connect to ports.ubuntu.com:443 (91.189.91.39). - connect (111: Connection refused) Could not connect to ports.ubuntu.com:443 (91.189.91.38). - con
nect (111: Connection refused)
W: Failed to fetch https://ports.ubuntu.com/ubuntu-ports/dists/focal-updates/InRelease Unable to connect to ports.ubuntu.com:https:
W: Failed to fetch https://ports.ubuntu.com/ubuntu-ports/dists/focal-backports/InRelease Unable to connect to ports.ubuntu.com:https:
W: Failed to fetch https://ports.ubuntu.com/ubuntu-ports/dists/focal-security/InRelease Unable to connect to ports.ubuntu.com:https:
W: Some index files failed to download. They have been ignored, or old ones used instead.
Debian 中不存在这样的问题。
答案1
这回购服务器看起来 https 配置错误。
$ # works fine on port 80
$ curl -I -v http://ports.ubuntu.com
* Trying 91.189.91.38:80...
* Connected to ports.ubuntu.com (91.189.91.38) port 80 (#0)
> HEAD / HTTP/1.1
> Host: ports.ubuntu.com
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Date: Mon, 30 Aug 2021 03:30:23 GMT
Date: Mon, 30 Aug 2021 03:30:23 GMT
< Server: Apache/2.4.29 (Ubuntu)
Server: Apache/2.4.29 (Ubuntu)
< Content-Type: text/html;charset=UTF-8
Content-Type: text/html;charset=UTF-8
<
* Connection #0 to host ports.ubuntu.com left intact
$
$
$ # ssl issue on port 443
$ curl -I -v -k https://ports.ubuntu.com
* Trying 91.189.91.38:443...
* Connected to ports.ubuntu.com (91.189.91.38) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
* CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to ports.ubuntu.com:443
* Closing connection 0
curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to ports.ubuntu.com:443
$