<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi guys,</div><div>I'm testing my config on localhost with nginx/1.15.7 before deploying. Since I only want to handle specific hostnames, I setup a catch-default:</div><div><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><div><div><font face="monospace, monospace">server {</font></div></div></div></div><div><div><div><div><font face="monospace, monospace"><br></font></div></div></div></div><div><div><div><div><font face="monospace, monospace"><span style="white-space:pre-wrap"> </span>listen 443 ssl default_server;</font></div></div></div></div><div><div><div><div><font face="monospace, monospace"><span style="white-space:pre-wrap"> </span>...</font></div></div></div></div><div><div><div><div><span style="white-space:pre-wrap"><font face="monospace, monospace"> </font></span></div></div></div></div><div><div><div><div><font face="monospace, monospace"> return 400;</font></div></div></div></div><div><div><div><div><font face="monospace, monospace">}</font></div></div></div></div><div><font face="monospace, monospace"><br></font></div></blockquote><font face="arial, helvetica, sans-serif">Then I setup my real config:</font></div></div></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div><div><font face="monospace, monospace"><br></font></div></div></div><div><div><div><div><font face="monospace, monospace">server {</font></div></div></div></div><div><div><div><div><font face="monospace, monospace"><br></font></div></div></div></div><div><div><div><div><font face="monospace, monospace"><span style="white-space:pre-wrap"> </span>server_name localhost;</font></div></div></div></div><div><div><div><div><font face="monospace, monospace"><span style="white-space:pre-wrap"> </span>root /usr/share/nginx/html;</font></div></div></div></div><div><div><div><div><div><font face="monospace, monospace">listen 443 ssl http2;</font></div></div></div></div></div><div><div><div><div><div><font face="monospace, monospace">listen [::]:443 ssl http2;</font></div></div></div></div></div><div><div><div><div><div><font face="monospace, monospace">...</font></div></div></div></div></div><div><div><div><div><div><font face="monospace, monospace">}</font></div></div></div></div></div></blockquote><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><br></div><div><br></div><div>My /etc/hosts:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">127.0.0.1 localhost test.localhost <a href="http://bogus.com" target="_blank">bogus.com</a></font></div></blockquote><div><br></div><div>It works almost as expected: if I open <a href="https://127.0.0.1" target="_blank">https://127.0.0.1</a> or <a href="https://bogus.com" target="_blank">https://bogus.com</a> I get my error page, as I expected, and if I open <a href="https://localhost" target="_blank">https://localhost</a> I see my site.</div><div><br></div><div><b>The problem is</b>: if I open <a href="https://test.localhost" target="_blank">https://test.localhost</a> , I also see my website! What? why? my server isn't defined for this hostname!</div><div><br></div><div>What am I doing wrong?</div><div><br></div><div>Thanks!</div><br clear="all"><div><div dir="ltr" class="m_3355238982514336777gmail_signature"><div dir="ltr"><div><div><span style="font-family:monospace,monospace">O----------------------------------------------------O<br>| Dr. Gianluigi Zanettini <a href="mailto:info@zane.it" target="_blank">info@zane.it</a> |<br>| Tel: +39 338 8562977 Fax: +39 0532 9631162 |<br></span></div><span style="font-family:monospace,monospace">| <a href="http://TurboLab.it" target="_blank">http://TurboLab.it</a> <a href="http://zane.it" target="_blank">http://zane.it</a> |<br></span></div><span style="font-family:monospace,monospace">O----------------------------------------------------O<br></span></div></div></div></div></div></div></div></div></div>
</div></div>