Hey everybody
im very curious as to why this works:
server {
listen 111.111.111.111:443 default_server ssl;
ssl_certificate /usr/share/nginx/sites/example.com/ssl/crt;
ssl_certificate_key /usr/share/nginx/sites/dexample.com/ssl/key;
return 404;
}
server {
listen 80;
listen 111.111.111.111:443;
server_name example.com;
root /usr/share/nginx/sites/example.com/webroot
}
if i access https://example.com it opens the index file in the webroot folder... if i access https://111.111.111.111 it returns a 404 error (after the obvious certificate error)... so it actually works as intended... the big question is why???
shouldnt a request to https://example.com also return a 404 since the first server block gets chosen because its default?
i dont even have to add ssl_certificate to the second server block, why is that ?
i appreciate ur answers, thanks a lot...