關於錯誤程式碼107(err_ssl_protocol_error)SSL 協議出錯的解決方案

hdgara1發表於2020-05-13

關於錯誤程式碼107(err_ssl_protocol_error)SSL 協議出錯的解決方案

火狐瀏覽器訪問  出現一個很怪異的問題,報錯:

ssl 107 (net::ERR_SSL_PROTOCOL_ERROR)

剛開始以為是ssl失效了,重新安裝了一遍

安裝過程:

第一步# openssl genrsa -des3 -out server1.key 1024
Generating RSA private key, 1024 bit long modulus
……++++++
……..++++++
e is 65537 (0x10001)
Enter pass phrase for server1.key:此處設定個密碼
Verifying – Enter pass phrase for server1.key:重新輸入設定個密碼

第二步# openssl req -new -key server1.key -out server1.csr
Enter pass phrase for server1.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter ‘.’, the field will be left blank.
—–
Country Name (2 letter code) [GB]:CN
State or Province Name (full name) [Berkshire]:Beijing
Locality Name (eg, city) [Newbury]:Beijing
Organization Name (eg, company) [My Company Ltd]:xo
Organizational Unit Name (eg, section) []:xo
Common Name (eg, your name or your server’s hostname) []:xo
Email Address []:

Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:此處回車
An optional company name []:此處回車

第三步:#cp server1.key server1.key.org

第四步:# openssl rsa -in server1.key.org -out server1.key
Enter pass phrase for server1.key.org:此處輸入剛才設定的密碼
writing RSA key

第五步:]# openssl x509 -req -days 365 -in server1.csr -signkey server1.key -out server1.crt
Signature ok
subject=/C=CN/ST=Beijing/L=Beijing/O=xo/OU=xo/CN=xo
Getting Private key

安裝完ssl,配置nginx虛擬主機

server
{
listen 80;
server_name  
root /data0/htdocs/zhaolilei;
index index.html index.PHP;
rewrite ^/   permanent;

location ~ .*\.(php|php5)?$
{
#fastcgi_pass  unix:/tmp/php-cgi.sock;
fastcgi_pass  127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
access_log /data1/logs/test1.log;
}

server
{
listen 443;
server_name  
root /data0/htdocs/zhaolilei;
index index.html index.php;

ssl on;
ssl_certificate server.crt;
ssl_certificate_key server.key;

location ~ .*\.(php|php5)?$
{
#fastcgi_pass  unix:/tmp/php-cgi.sock;
fastcgi_pass  127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
access_log /data1/logs/test.log;
}

配置完後訪問測試,依然是報錯,後來在網上查了N多資料也沒有個說法

靜下來想想,這個之前是好用的,最近貌似只升級過nginx版本為1.2.1,難道與版本有關,新版本的nginx有一些規則改了,比如:日誌格式要放在虛擬主機上邊定義,後可官網也沒有查出相關問題。猜想會不會與虛擬主機的順序有關,我這裡先配置的80,後配置的443

經過測試,果然如此,把443的虛擬主機放置到80的上邊,重啟nginx,訪問OK了

採用了技術含量比較高的加密技術。日後 )將會持續為大家推薦更多關於SSL證照的技術知識。讓大家正確認識SSL證照,快速無誤部署HTTPS安全協議。更多資訊,請關注GDCA。

全球可信CA機構

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31483669/viewspace-2691821/,如需轉載,請註明出處,否則將追究法律責任。

相關文章