# 默认的服务器块,用于阻止未匹配的HTTPS请求
本地生成证书
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/default.key -out /etc/nginx/ssl/default.crt
# 防止别人输入其他没有配置ssl的域名,跳到其他server上
server {
listen 443 default_server ssl;
server_name _;
ssl_certificate /etc/nginx/ssl/default.crt;
ssl_certificate_key /etc/nginx/ssl/default.key;
return 404;
}
标签:ssl,etc,default,配置,server,nginx,key
From: https://www.cnblogs.com/hlgg/p/18206125