記錄一次升級https走過的坑

記錄一次升級https過程中走過的坑

curl: (51) SSL: certificate subject name 'mp3.xxx.com' does not match target host name 'static.xxx.com'


升級 http://mp3.xxx.com  

        http://static.xxx.com

        https://mp3.xxx.com

        https://static.xxx.com

       因在一臺服務器上配置的兩個域名都解析到本機,配置完後,發現頁面的靜態文件都無法加載

於是F12看了下,發現加載的證書和瀏覽器地址欄的域名竟然不一致。請求的static這個域名,確加

載的mp3的證書。用curl也報錯,不能正常返回200,納悶了!

wKiom1kVUdShTRn_AAEWh3KimtM195.png-wh_50


[root@web ~]# curl -I https://static.xxx.com/static/lib/less.min.js

curl: (51) SSL: certificate subject name 'mp3.xxx.com' does not match target host name 'static.xxx.com'

wKiom1kVVTiBXarsAAAXOto0L40811.png-wh_50



       後來求助偉大的谷歌,發現原來是nginx的TLS SNI support功能沒開,SNI (服務器名字指示)不開啓的話,一個IP只支持一個SSL證書,不支持多個證書,而服務器是yum安裝的nginx,默認TLS SNI support是關閉的,重新編譯nginx並指定openssl庫後,TLS SNI support 開啓了,訪問就正常了

    yum update openssl

    或

    cd openssl-1.0.0d 

    ./config --prefix=/usr/local/openssl

    make && make install

    ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_stub_status_module --with-http_addition_module --with-http_realip_module --with-openssl=/usr/local/src/openssl-1.0.0d


       另外的一個問題是這種情況下用curl測試時,狀態碼不能正常返回200,開啓LS SNI support後也依然報錯,不能正常返回200。看curl官網有人反饋,這好像是curl版本7.15.5的BUG,用比7.15.5新的curl 7.19.7版本測試就正常。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章