<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">That's exactly what I tried first, and if there are multiple servers listening to same ports, I get the following error:<br>nginx: [emerg] duplicate listen options for [::]:80 in /etc/nginx/conf.d/***.conf:3<br>



</div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">See follow-up messages or (through the forum archive on this subject): <a href="http://forum.nginx.org/read.php?2,238147,238152#msg-238152" target="_blank">http://forum.nginx.org/read.php?2,238147,238152#msg-238152</a><br>



</div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">I have the feeling we entered a loop back to the top of the subject...<br>



</div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Let me summarize :<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">



<b>Attempt #1</b><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><span style="color:rgb(180,95,6)">listen 80;<br>listen [::]:80 ipv6only=on;</span><br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">



Only works if a <i><b>single</b></i> server contains those directives.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Produces error 'nginx: [emerg] duplicate listen options for [::]:80 in /etc/nginx/conf.d/***.conf:3' if several servers use them to listen to the same ports.<br>



<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><b>Attempt #2</b><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><span style="color:rgb(180,95,6)">listen [::]:80;</span><br>



<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">'Wrong approach' said Maxim, since it won't work in 1.4 stable due to changes in the 1.3 dev branch.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">



However, in 1.2, that's the only working way I have to decide on per-server level which protocol and ports they need to listen to.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><br>


</div>
<div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">I'm stuck.<br></div><div class="gmail_extra"><div><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font></div>



<br><br><div class="gmail_quote">On Sat, Apr 6, 2013 at 11:23 AM, Igor Sysoev <span dir="ltr"><<a href="mailto:igor@sysoev.ru" target="_blank">igor@sysoev.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word"><div>server {</div><div><div>     listen 80;</div><div>     listen [::]:80 ipv6only=on;</div></div><div>     server_name  one;</div><div>     ...</div><div>}</div><div><br></div>
<div><div>server {</div><div>     listen 443 ssl;</div><div>     listen [::]:443 ssl ipv6only=on;</div><div>     server_name  one;</div><div>     ...</div><div>}</div></div><div><br></div><div><br></div><div><div><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px"><div style="word-wrap:break-word">



<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px"><div style="word-wrap:break-word">



<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px">--<br>



Igor Sysoev<br></span></div><div style="word-wrap:break-word"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Georgia;word-spacing:0px"><a href="http://nginx.com/services.html" target="_blank">http://nginx.com/services.html</a></span></div>



</span></div></span></span></div></div><div><div><div><br></div><div><div>On Apr 6, 2013, at 19:01 , B.R. wrote:</div><br><blockquote type="cite"><div dir="ltr"><div style="font-size:small;color:rgb(51,51,153)">
Add-on:<br><br>Besides, as I explained earlier, having generic 'listen' directives implies some difficulties.<br></div><div style="font-size:small;color:rgb(51,51,153)">

<br>For example, I am using 2 virtual servers to serve content for the same server_name, one listening on port 80, the other on port 443, allowing me to serve cotnent for HTTP and HTTPS in different fashions.<br></div><div style="font-size:small;color:rgb(51,51,153)">





Using generic 'listen' directive breaks that system and I'm stuck.<br><br></div><div style="font-size:small;color:rgb(51,51,153)">What would be an acceptable solution?<br>Thanks,<br></div>

<div class="gmail_extra"><div><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font></div>
<br><br><div class="gmail_quote">On Sat, Apr 6, 2013 at 10:52 AM, B.R. <span dir="ltr"><<a href="mailto:reallfqq-nginx@yahoo.fr" target="_blank">reallfqq-nginx@yahoo.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">





<div dir="ltr"><div style="font-size:small;color:rgb(51,51,153)">But as I noticed earlier, these configuration directives conflict with each other across multiple virtual servers...<br>That's a huge step backwards.<br>






<br></div>H<div style="font-size:small;color:rgb(51,51,153);display:inline">​aving to specify them only once across every configuration file is counter-intuitive.<br></div><div style="font-size:small;color:rgb(51,51,153);display:inline">






Why isn't nginx able to ​summarize all the needs for listening sockets across configuraiton files before attempting to open them?<br></div><div style="font-size:small;color:rgb(51,51,153);display:inline">
Having to define those listening directives in a 'generic default server' is awkward and looks ugly.<br></div></div><div class="gmail_extra"><br clear="all"><div><font size="1"><span style="color:rgb(102,102,102)">---<br>






</span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font></div><div><div>
<br><br><div class="gmail_quote">On Sat, Apr 6, 2013 at 6:39 AM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">






Hello!<br>
<div><br>
On Sat, Apr 06, 2013 at 02:25:54AM -0400, B.R. wrote:<br>
<br>
> Hello,<br>
><br>
> It seems I solved the problem...<br>
> It was indeed by reading a little more carefully the doc<br>
> <a href="http://wiki.nginx.org/HttpCoreModule#listen" target="_blank">http://wiki.nginx.org/HttpCoreModule#listen</a>, thanks @Lukas! ;o)<br>
><br>
> The '*:80' syntax is used for IPv4 listening, I don't understand why it<br>
> works as-is for you Ted. Maybe Maxim will be of a better help on that case.<br>
><br>
> It is said that the IPv6 syntax will make Nginx listen for the 6to4 IP<br>
> address syntax, making the websites reachable through IPv4, even if no<br>
> specific IPv4 binding exist for the listening sockets.<br>
> Using:<br>
> listen [::]:80;<br>
><br>
> I have:<br>
> $ sudo ss -lnp|grep nginx<br>
> 0      128                           :::80<br>
> :::*      users:(("nginx",***,11),("nginx",***,11))<br>
> 0      128                           :::443<br>
> :::*      users:(("nginx",***,12),("nginx",***,12))<br>
><br>
</div>> You shall *not* have 2 'listen' directive if you did not separate you IPv6<br>
<div>> and IPv4 stacks (with the sysctl net.ipv6.bindv6only directive set to 1).<br>
<br>
</div>This is wrong aproach and it will no longer work for you after<br>
1.3.x upgrade.  As I already suggested, use<br>
<div><br>
   listen 80;<br>
   listen [::]:80 ipv6only=on;<br>
<br>
</div>instead as a portable solution, which doesn't depend on a system<br>
configuration.  (In 1.3.x, the "ipv6only=on" part can be removed<br>
as it's now the default.)<br>
<div><div><br>
--<br>
Maxim Dounin<br>
<a href="http://nginx.org/en/donation.html" target="_blank">http://nginx.org/en/donation.html</a><br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div>
_______________________________________________<br>nginx mailing list<br><a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br><a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a></blockquote>



</div><br></div></div></div><br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br></blockquote></div><br></div></div>