我有一台同时运行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块供参考:
<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配置为位于该端口上。
请问有人可以启发我为什么会发生这种情况吗?谢谢!
答案 0 :(得分:1)
在为网站设置SSL的 Ubuntu 20.04 上的 Apache2 网络服务器上工作时,我遇到了同样的问题。
每次我执行curl请求:
curl https://corebanking.test.vggdev.com
OR
curl https://my-website.com:443
我得到了错误:
curl: (35) error:1408F10B:SSL routines:ssl3_get_record:wrong version number
我检查了网站(my-website.conf
的配置文件,看起来不错。
这是我修复的方式:
我发现我在my-website.conf
目录中没有网站(/etc/apache2/sites-enabled
)的配置文件。因此未启用该配置。
我要做的就是将my-website.conf
链接到/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 Web服务器:
sudo systemctl restart apache2
仅此而已。
我希望这会有所帮助
答案 1 :(得分:0)
结果是,域首先指向了错误的服务器!这就是显示错误的原因。将域的A记录指向正确的服务器后,配置都正确。