Virtual hosts sharing same port

Maxim Dounin mdounin at mdounin.ru
Mon Apr 16 16:31:17 UTC 2018


Hello!

On Mon, Apr 16, 2018 at 11:04:16AM -0400, Peter Booth wrote:

> Does this imply that that different behavior *could* be achieved 
> by first defining virtual IP addresses (additional private IPs 
> defined at the OS) which were bound to same physical NIC, and 
> then defining virtual hosts that reference the different VIPs, 
> in a similar fashion to how someone might configure a hardware 
> load balancer?

Yes, you can have different listening sockets configured with different 
options, e.g.:

    server {
        listen <ip1>:443 ssl http2;
        ...
    }

    server {
        listen <ip2>:443 ssl; # no http2 here
        ...
    }

Note though that you have to direct clients to these different IP 
addresses, so using private IPs won't work.  Rather, you have to 
use different public IPs.

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


More information about the nginx mailing list