Ubuntu SSH 上的 OpenSSL 版本号错误

sta*_*355 2 ssl openssl nginx

我将我的 nginx 设置为监听端口 8080 这是我的配置文件,当我使用http例如访问时它可以工作http://myweb.com:8080/api/

server {
    listen 8080;

    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_ssl_server_name on;
    }
}
Run Code Online (Sandbox Code Playgroud)

然而,当我尝试使用httpsInsomnia 访问它时,它会返回SSL connect error。当我尝试时 curl https://myweb.com:8080 --verbose 它返回类似这样的内容:

*   Trying {myipadress}:8080...
* Connected to myweb.com (ipaddress) port 8080 (#0)
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: none
* OpenSSL/3.0.8: error:0A00010B:SSL routines::wrong version number
* Closing connection 0
curl: (35) OpenSSL/3.0.8: error:0A00010B:SSL routines::wrong version number
Run Code Online (Sandbox Code Playgroud)

我已经配置了两天了,不知道哪里出了问题,有人有类似的问题吗?

Ste*_*ich 8

此错误是由于仅https://在目标和端口上使用而导致的,该目标和端口配置为普通http://

HTTPS和HTTP是不同的协议,需要在不同的端口上进行配置,也需要不同的配置。特别支持HTTPS还需要在服务器端配置证书。有关如何配置 HTTPS 的信息,请参阅nginx 文档。

  • @stanley355:用粗体引用我自己的相关部分:*“.... __需要在不同的端口上配置__并且还需要不同的配置”* (2认同)