赞
踩
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;
}
}}
更改后配置文件:
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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。