To configure Ipv6 on multiple domains on an nginx server you must include the
listen [::]:80;
line in every server. The trick is to also include
listen [::]:80 default_server ipv6only=on;
onto the server server/domain that nginx is listening to.
Here is an example configuration with two sites both of which respond to IPv4 and Ipv6:
#first domain name config server { listen 80; ## listen for ipv4; this line is default and implied listen [::]:80 default_server ipv6only=on; ## listen for ipv6 (…) }
#second doamin name config
server {
listen 80; ## listen for ipv4; this line is default and implied
listen [::]:80; ## listen for ipv6
(...)
}
If you do anything else you will likely get errors that [::]:80 is already in use. Something like:
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)