nginx升级到1.16.0后ssl报错的解决办法

配置完ssl证书,sudo nginx -t检查配置是否有误时,报错
nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/halo.conf:4

查看官方文档:
4bcb1daff4e8b02c49e01009b31c9ff.png

原来是新版本Nginx里面不支持ssl on这样的命令,我们只需要去把nginx配置文件里面的ssl on;那一行删除就行了。

重新检查并重载 Nginx 配置,OK

[root@codenow conf.d]# sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@codenow conf.d]# sudo nginx -s reload