Nginx the “ssl“ directive is deprecated, use the “listen ... ssl“

问题描述

  • 配置Nginx 抛出如下提示信息:
[warn] 1#1: the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/nginx.conf:22
2021-01-21T03:02:01.837187000Z nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/nginx.conf:22

原因

  • 由于新版nginx采用新的方式进行监听https请求,需要修改配置

解决

  • 删除 ssl on,修改listen 443 ssl
# 解决前(删除)
server {
      listen 443 ; ssl on; }

# 解决后(保留)
server {
      listen 443 ssl ; }

你可能感兴趣的:(Nginx,ssl,Nginx)