首页 > 文章列表 > 相关知识 > 查看文章

宝塔"在未指定SSL默认站点时,未开启SSL的站点使用HTTPS会直接访问到已开启SSL的站点"的问题解决办法

所属分类:相关知识 来源: 丁老师原创 更新时间:2020-12-02 15:35

宝塔里边管理了多个网站,有的网站有ssl,有的没有,有一天被客户告知了其网站的搜狗索引被定向到了另一个开通https的网站,很纳闷,就研究了下。

原来宝塔网站设置里,在SSL中提示“在未指定SSL默认站点时,未开启SSL的站点使用HTTPS会直接访问到已开启SSL的站点”,也就是说只要有一个开通了ssl的站,其他站的ssl没有开通时,都会被指向到这个开通ssl的站,而搜索引擎不管你有没有,只管用ssl去抓取,所以才会出现以上的情况。


关于这种情况,研究了下,有两个解决办法:

一个是网上找的,给没有或不需要ssl的网站配置一个无效的ssl,让他不指向到其他ssl网站即可,内容如下

.key文件代码:

-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAlcZJiGVMbbzrWzkmhBJxjoMbFSSCtLzcY0poxwTxyxzd2pw1
45OIV9WllYNTotQyOheiJEN9hGgU/qjIRpKg/1KrSnxsykYwevMjsyM/Rs3W7MRr
EGjCqr9VfWCnC/mOhwrSeEtL76DaMTpYIYIVemK+W+BajKD5nNekjs6567phMFbm
Bsqil3hXWE31GyIaYwQqbMWI1gCSX/Tvh3dmt2dVE2/7q4soZPVSlNqEq92UENqR
6k3aQS+PoKOBj9b4Y1wtveL0bNOHqi4e7iXtucPnlWLlrpylm1ybm9Q0AUm4X0N0
k1XFB8hyOWHH0SgczbKbbHfaJEWi7kDVsUCL1wIDAQABAoIBAQCKUzJwbRX0N8mq
W5Lt4VbNRtqJYUnyAIcOkJdKT4+8hfGDyEeg4g3HCUM/XaWtuYqVymPuWAKhebsC
IwGs5BkbFc+rIFUdT0vREaND++ahztOToig7ZHV9Wu5quAwvbBEtOVp+zRPZwVYi
pv7kG48Yk/+5PPCD9tvx9ds+JUDiqrD9jEEz8WfxziFeCeO/HsjDJwKN363qGNCh
lvvslAZXyRmdyWGywCG5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/aGq7aBZsxf/oQ+TD/B
SwW3AU4ETK+GQf2kFzYZkby5SFrHdPomunx2HBzViUchGoofGgg7gHW0W3MlQAXW
M0r5LUvStcr82QDWYNPaUy4taCQmyaJ+VB+6wxHstSigOlSNF2a6vg4rgexixeiV
4YSB03Yqp2t3TeZHM9ESfkus74nQyW7pRGezj+TC44xCagCQQOzzNmzEAP2SnCrJ
sNE2DpRVMnL8J6xBRdjmOsC3N6cQuKuRXbzByVBjCqAA8t1L0I+9wXJerLPyErjy
rMKWaBFLmfK/AHNF4ZihwPGOc7w6UHczBZXH5RFzJNnww+WnKuTPI0HfnVH8lg==
-----END CERTIFICATE-----

以上代码直接拷贝即可使用。虽然以上是过期的证书,但也是可以用于解决问题。



另一种是我自己发明的,在每个站单独的配置文件,也就是nginx设置中,在listen 80;下边增加依据listen 443 ssl http2;保存后即可解决问题,如果提示错误解决不了,那么就采用第一种办法即可,两个办法搭配使用。

dls6.jpg

相关文章

ecshop微信文章采集插件下载

适用于ecshop的微信文章采集插件包

python3.12提示windows No...

在使用python3.12时突然遇到提示windowsNomodulenameddistut...

苹果Iphone无法连接BMW宝马Carpl...

最近在使用iphone连接车上的carplay时,突然提示“请确定bmw已经打开并在通信范围...

dls6微商城

丁老师网店系统,dls6微商城

推荐文章

photoshop宽度像素和网页宽度像素不一...

在日常设计时,有的同学会发现,在网页中设置的宽度1000px,截图用photoshop打开后...

fastadmin后台列表默认分页数量由10...

没那么多废话,直接上修改方法public\assets\js\require-table.j...

bt宝塔升级方法

由老版本7.2自动升级时,会出现很多问题,建议在终端手动升级。升级命令:curlhttp:/...

videojs宽度高度自适应100%的方法

videojs是一款非常不错的htmlvideo播放器插件,很多同学经常在群里问我,说丁老师...