配置nginx支持http2的时候,需要配置https协议,我在本地生成了证书,但是访问网站的时候就报下面这个错,经过查询一些资料得知,可能原因是ssl协议版本和加密方式不匹配导致。改了加密方式之后可以正确访问了。
修改后的配置:
server {
listen 8085 ssl http2;
ssl_certificate cert/server.pem;
ssl_certificate_key cert/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_protocols SSLv2 SSLv3 TLSv1;(因为这个报错)
ssl_ciphers EECDH+AES128:HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
root /mnt/share/xxx.xxx.com;
location / {
if (!-f $request_filename) {
proxy_pass http://127.0.0.1:9502;
}
}
if ( $server_port = 80 ){
rewrite ^(.*) https://$server_name$1 permanent;
}
}