I want to have a default server to catch all undeclared hosts requests

server {
    listen 80 default_server;
    listen 43 default_server ssl;
    server_name _;

    return 403;

I have this server block, but it doesn't work with https. When an undeclared host is requested the first server block with a ssl certificate is returned!?

  • This isn't a valid server block, since it doesn't specify an SSL certificate! Commented Nov 22, 2015 at 12:19

1 Answer 1


listen 443

ssl_certificate www.example.com.crt;

ssl_certificate_key www.example.com.key;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

ssl_ciphers HIGH:!aNULL:!MD5; ...

see the following: http://nginx.org/en/docs/http/configuring_https_servers.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .