Virtual hosts sharing same port

Maxim Dounin mdounin at mdounin.ru
Mon Apr 16 16:49:20 UTC 2018


Hello!

On Mon, Apr 16, 2018 at 08:13:42AM -0700, Frank Liu wrote:

> Does that mean nginx will read and combine listen options from 
> all virtual hosts and use that to create listening socket? 

Yes.  You can configure something like this:

   server {
       listen 443 ssl;
       ...
   }

   server {
       listen 443;
       ...
   }

and both servers will use SSL.  Moreover, currently you can do 
something like this:

   server {
       listen 443 ssl;
       ...
   }

   server {
       listen 443 http2;
       ...
   }

and both servers will use SSL and HTTP/2.  (The latter is actually 
very confusing, and likely will result in warnings / errors during 
configuration parsing in future versions.)

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list