原因:
nginx在1.15.x版本之后不再使用 ssl on;
解决方法:
ssl on; 要去掉,将 listen 443; 改为 listen 443 ssl;
原配置文件:
worker_processes 1;events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
}
server {
# 监听443 端口
listen 443;
# 配置域名
server_name xxxx.com;
# 开启SSL验证
ssl on;
# 指定 ssl 证书路径
ssl_certificate /opt/ssl/xxxx.pem;
# 指定私钥文件路径
ssl_certificate_key /opt/ssl/xxxx.key;
# 客户端可复用会话的时间
ssl_session_timeout 5m;
# 指定启用的加密器类型,默认 ssl_ciphers HIGH:!aNULL:!MD5;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
# ssl_protocols:表示使用的TLS协议的类型,默认是TLSv1 TLSv1.1 TLSv1.2
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
# 指定服务端加密器优先: 参数为on开启,默认off关闭;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}}
文章来源:https://www.toymoban.com/news/detail-757655.html
更改后配置文件:
worker_processes 1;events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
}
server {
# 监听ssl 443 端口
listen 443 ssl;
# 配置域名
server_name xxx.com;
# 指定 ssl 证书路径
ssl_certificate /opt/ssl/xxxx.pem;
# 指定私钥文件路径
ssl_certificate_key /opt/ssl/xxxx.key;
# 客户端可复用会话的时间
ssl_session_timeout 5m;
# 指定启用的加密器类型,默认 ssl_ciphers HIGH:!aNULL:!MD5;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
# ssl_protocols:表示使用的TLS协议的类型,默认是TLSv1 TLSv1.1 TLSv1.2
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
# 指定服务端加密器优先: 参数为on开启,默认off关闭;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}}
验证修改:
root@roc:~# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful文章来源地址https://www.toymoban.com/news/detail-757655.html
到了这里,关于nginx: [warn] the “ssl“ directive is deprecated, use the “listen ... ssl“ directive instead in /的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!