I connected two nginx listen 1.2.3.4:443 : one was listen 1.2.3.4:443 in the other listen 443 . Domains are different, both worked on two servers. Connect the first to listen 1.2.3.4:443 at the beginning, with listen 443 at the end of the config. The second domain has stopped working. Attached the second domain include th, so I did not immediately notice the difference with listen 443 . Those. when you add an IP to the second domain ( listen 1.2.3.4:443 ) it worked. Please explain what was the difference. As I understand it, the processing rule was violated and the second config without IP was simply not readable by nginx. But where to read about the priority of processing, because both configurations worked without problems.

    1 answer 1

    listen 443 - nginx listens to port 443 on all interfaces

    listen 1.2.3.4:443 - nginx listens to port 443 on the interface with IP 1.2.3.4.

    How you “connected” the configurations is not very clear. If possible, give an abbreviated example.

    Read about priorities here or here.

    • Exactly, thanks. This is called read, but not read. "An SSL connection is established before the browser sends an HTTP request, and nginx does not know the name of the requested server. Consequently, it can only offer a server certificate by default." I had a second domain, like listen 443 without an IP address, so the browser received a default server certificate from the first domain, as written in your link. Thanks again for poking at the right place))) - Viktor S
    • For those who get here through the search. If we read below, here nginx.org/ru/docs/http/configuring_https_servers.html#sni says that it should work without specifying IP. You need to check "TLS SNI support enabled" for the nginx version. Then it should work from 0.0.0.0 instead of specifying the IP interface - Viktor S