nginx the “ssl“ directive is deprecated, use the “listen ... ssl“报错

时间:2024-03-10 16:49:43

Nginx 配置SSL 证书重载时报错

nginx: [warn] the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /xxx.conf:31

解决方案 :

listen 443 ssl;

删除或注释 ssl on;

server {
   listen 443 ssl; #修改端口号增加ssl
   server_name xxxx.cn;
    #ssl on; #注释或删除ssl on
	   ssl_session_timeout 5m;
       ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
       ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
       ssl_prefer_server_ciphers on;   
#指定PEM格式的证书文件   
    ssl_certificate     xxxx.pem;   
    #指定PEM格式的私钥文件  
    ssl_certificate_key  xxxx.key;
   location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass http://127.0.0.1:8088;
    # 保留所有请求头字段
    proxy_pass_request_headers on;
            }
}