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! – Michael Hampton Nov 22 '15 at 12:19

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.