Hi. Would something like this work for you?
server {
listen 80 default;
server_name _;
return 200 'default\n';
...
}
server {
listen 80;
server_name ~^.*\..*\..*$;
return 444;
}
Testing with curl...
[root@nginx-splunk conf.d]# curl -H "Host:example123.com" localhost
default
[root@nginx-splunk conf.d]# curl -H "Host:example456.com" localhost
default
[root@nginx-splunk conf.d]# curl -H "Host:subdomain.example456.com" localhost
curl: (52) Empty reply from server
[root@nginx-splunk conf.d]# curl -H "Host:subdomain.example123.com" localhost
curl: (52) Empty reply from server
--Kevin
@webopsx
server {
listen 80 default;
server_name _;
return 200 'default\n';
...
}
server {
listen 80;
server_name ~^.*\..*\..*$;
return 444;
}
Testing with curl...
[root@nginx-splunk conf.d]# curl -H "Host:example123.com" localhost
default
[root@nginx-splunk conf.d]# curl -H "Host:example456.com" localhost
default
[root@nginx-splunk conf.d]# curl -H "Host:subdomain.example456.com" localhost
curl: (52) Empty reply from server
[root@nginx-splunk conf.d]# curl -H "Host:subdomain.example123.com" localhost
curl: (52) Empty reply from server
--Kevin
@webopsx