ipv4 & ipv6 Virtual Hosting - address in use

Igor Sysoev igor at sysoev.ru
Wed Dec 1 23:31:11 MSK 2010


On Wed, Dec 01, 2010 at 03:20:15PM -0500, David J. wrote:

> Thanks for the responses;
> 
> I am running ubuntu 10.10 on these particular instances;
> 
> I was able to get it working however; its going to the first server 
> configured;
> 
> So I am still not quite sure how to fix;
> 
> I will try playing around a bit more.

You should set "ipv6only" option only in one server
with "default_server" flag:

server {
    listen       80;
    listen       [::]:80 default_server ipv6only=on;
    server_name  domain1.com;
    ...
}

server {
    listen       80;
    listen       [::]:80;
    server_name  domain2.com;
    ...
}

> On 12/1/10 3:10 PM, António P. P. Almeida wrote:
> > On 1 Dez 2010 19h24 WET, david at styleflare.com wrote:
> >
> >> I have latest nginx configured;
> >>
> >> I have one that is purely ipv6 and one that is purely ipv4;
> >>
> >> They both work fine in a multi-server environment;
> >>
> >> server {
> >> listen          80;
> >> #       listen       [::]:80 ipv6only=on;
> >>
> >> server_name  domain1.com;
> >>
> >> #charset koi8-r;
> >>
> >> #access_log  logs/host.access.log  main;
> >>
> >> location / {
> >> root   html;
> >> index  index.html index.htm;
> >> }
> >>
> >> }
> >>
> >> server {
> >> listen          80;
> >> #       listen       [::]:80 ipv6only=on;
> >>
> >> server_name  domain2.com;
> >>
> >> #charset koi8-r;
> >>
> >> #access_log  logs/host.access.log  main;
> >>
> >> location / {
> >> root   html;
> >> index  index.html index.htm;
> >> }
> >> }
> >>
> >> If I un-comment to bind to ipv6 as well as ipv4; when nginx starts
> >> it complains the address is in use;
> >>
> >>
> >> I saw a patch for this here is the post;
> >>
> >> But according to that post it has been included in 8.39 I am using
> >> 8.53
> > Cf http://wiki.nginx.org/HttpCoreModule#listen
> >
> > AFAIK, it depends on what type of sockets your OS support, IPv4 only,
> > IPv4+IPv6 hybrid or IPv4 and IPv6 separate.
> >
> > If you're in a OS that supports hybrid sockets then it seems that your
> > config is incorrect, in the sense that it assumes separate IPv6 and
> > IPv4 sockets.
> >
> > Also, AFAIK, Linux uses hybrid sockets by default, while FreeBSD uses
> > separate sockets for IPv4 and IPv6.
> >
> > Perhaps someone more knowledgeable than I in OS' kernel networking
> > internals can chime in.
> >
> > HTH,
> > --- appa
> >
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://nginx.org/mailman/listinfo/nginx
> >
> 
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx

-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list