ᕕ( ᐛ )ᕗ Jimyag's Blog

nginx 未匹配域名时返回 404

# default.conf
map $scheme $hsts_header {
    https   "max-age=63072000;includeSubDomains; preload";
}
server {
    listen 80 default_server;
    listen [::]:80 default_server;
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;
    http2 on;
    server_name _;
    return 404;
}
nginx -t
# 如果不报错执行
nginx -s reload

# 或者
openresty -t
openresty -s reload

#nginx