ssl - Apache : cURL: ssl3_get_record:wrong version number for apache2 ssl

标签 ssl curl apache2.4

我有一台同时运行 2 个 Magento 站点的服务器。站点 1 在 SSL 下运行良好,而站点 2 每当我访问它时都会返回错误。

我尝试使用 cURL 测试网站:

curl -v https://example2-domain.com/

cURL 抛出此错误:

*   Trying 97.74.223.135...
* TCP_NODELAY set
* Connected to example2-domain.com (97.74.233.135) 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
* (304) (OUT), TLS handshake, Client hello (1):
* error:1408F10B:SSL routines:ssl3_get_record:wrong version number
* stopped the pause stream!
* Closing connection 0
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number

这是供引用的 Apache VirtualHost block :

<VirtualHost 97.74.233.135:8080>
    ServerName www.example-domain.com
    ServerAlias example-domain.com
    DocumentRoot /home/example/public_html
    DirectoryIndex index.php
    ServerAdmin webmaster@example-domain.com
    UseCanonicalName Off
    ScriptAlias /cgi-bin/ /home/example/public_html/cgi-bin/
    <Directory /home/example/public_html>
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost 97.74.233.135:8080>
    ServerName example-domain2.com
    DocumentRoot /home/example2/public_html
    DirectoryIndex index.php
    ServerAdmin webmaster@example-domain2.com
    UseCanonicalName Off
    ScriptAlias /cgi-bin/ /home/example2/public_html/cgi-bin/
    <Directory /home/example2/public_html>
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost 97.74.233.135:443>
    ServerAdmin webmaster@example-domain.com
    ServerName www.example-domain.com
    LogLevel warn
    ErrorLog /var/log/apache2/example-domain.com-ssl-error.log
    CustomLog /var/log/apache2/example-domain.com-ssl-access.log combined
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:6081/
    ProxyPassReverse / http://127.0.0.1:6081/
    RequestHeader set X-Forwarded-Port "443"
    RequestHeader set X-Forwarded-Proto "https"
    SSLEngine On
    SSLCertificateFile /ssl/example-domain.crt
    SSLCertificateKeyFile /ssl/example-domain-key.txt
    SSLCertificateChainFile /ssl/example-domain.ca-bundle
</VirtualHost>

<VirtualHost 97.74.233.135:443>
    ServerAdmin webmaster@example-domain2.com
    ServerName example-domain2.com
    LogLevel warn
    ErrorLog /var/log/apache2/example-domain2.com-ssl-error.log
    CustomLog /var/log/apache2/example-domain2.com-ssl-access.log combined
    ProxyPreserveHost On
    ProxyPass / http://127.0.0.1:6081/
    ProxyPassReverse / http://127.0.0.1:6081/
    RequestHeader set X-Forwarded-Port "443"
    RequestHeader set X-Forwarded-Proto "https"
    SSLEngine On
    SSLCertificateFile /ssl/example-domain2.com.crt
    SSLCertificateKeyFile /ssl/example-domain2-key.txt
    SSLCertificateChainFile /ssl/example-domain2.ca-bundle
</VirtualHost>

如果您想知道端口 6081 上有什么,Varnish 配置为位于该端口上。

谁能告诉我为什么会这样?谢谢!

最佳答案

Ubuntu 20.04 上的 Apache2 网络服务器上工作时,我在为网站设置 SSL 时遇到了同样的问题。

每次运行 curl 请求时:

curl https://corebanking.test.vggdev.com

curl https://my-website.com:443

我得到错误:

curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number

我检查了我的网站配置文件 (my-website.conf),它似乎没问题。

这是我修复它的方法:

我认为我在 /etc/apache2/sites-enabled 目录中没有网站的配置文件 (my-website.conf)。所以配置没有启用。

我所要做的就是将 my-website.conf 符号链接(symbolic link)到 /etc/apache2/sites-enabled 目录:

sudo ln -s /etc/apache2/sites-available/my-website.conf /etc/apache2/sites-enabled/my-website

接下来,我列出了 /etc/apache2/sites-enabled 目录的内容,以确保网站的配置文件 (my-website.conf ) 在那里:

ls /etc/apache2/sites-enabled/

最后,我重新启动了 apache2 网络服务器:

sudo systemctl restart apache2

就这些。

希望对您有所帮助

关于ssl - Apache : cURL: ssl3_get_record:wrong version number for apache2 ssl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56339135/

相关文章:

javascript - 通过javascript以编程方式将证书导入firefox受信任的根CA

php - 在 wamp 2.2 中调用未定义函数 curl_init() 错误

jquery - 启用 ssl 后 ajax post 不起作用

android - 带有受信任证书的 KSaop2 HttpsTransportSE 的 SSLHandshakeException

C SSL 代理 "Sniffer"/解密器

php - 使用 Laravel 任务调度请求 URL

python - 将基本的 CURL 转换为 Python 的请求

python - "NodeAlreadySaved "使用djangocms发布页面更改时报错

Apache (httpd) 无法启动,因为 "could not open error log"

python - apache 配置中的权限被拒绝 : [Errno 13] Permission denied