配置 Nginx 443(https ssl)未匹配域名时 返回404
这是80端口的正确写法
server { listen 80 default_server; server_name _; return 404; }
443端口不能简单的把80直接改成443,以下是正确的写法
server { listen 443 ssl http2 default_server; server_name _; ssl_certificate <path to key>;#必须 ssl_certificate_key <path to key>;#必须 return 404; }