nginx: 400 Bad Request | The plain HTTP request was sent to HTTPS port

nginx 版本nginx/1.12.2
在nginx环境下使用ssl链接出现问题400错误
nginx配置文件如下:
nginx:400 Bad RequestThe plain HTTP request

访问https时候正常,不过直接访问的时候会出现以下错误:
400 Bad Request The plain HTTP request was sent to HTTPS port错误

nginx:400 Bad RequestThe plain HTTP request

nginx:400 Bad RequestThe plain HTTP request

参考官方文档解决方法如下:
删掉ssl on; 并在 listen 443; 443后加上ssl即可

nginx:400 Bad RequestThe plain HTTP request

http直接访问演示正常:
nginx:400 Bad RequestThe plain HTTP request

到此解决