Hello, we have a bunch of servers which are configured 100% equal expect of host specific settings like ip address in the listener using chef/puppet. Nginx seems to read include / config files not in the same order on each server. For example we haven't defined a default vhost on each server... so nginx uses the first loaded file which is exampleA.com on server 1 and exampleB.com on server 2. Furhtermore we use the upstream check status module, the status page is randomly ordered at each server... Is it possible to configure nginx to read config in the alphabeticial order? For example vhosts/exampleA.com (1.) vhosts/exampleB.com (2.) ... Posted at Nginx Forum: http://forum.nginx.org/read.php?2,233269,233269#msg-233269
on 2012-11-27 15:08
on 2012-11-28 12:49
Hi, On Tue, Nov 27, 2012 at 10:07 PM, philipp <nginx-forum@nginx.us> wrote: > Furhtermore we use the upstream check status module, the status page is > randomly ordered at each server... > > Is it possible to configure nginx to read config in the alphabeticial > order? > > For example > > vhosts/exampleA.com (1.) > vhosts/exampleB.com (2.) > This is a known issue. It has been fixed in our own Tengine<http://tengine.taobao.org> distribution: https://github.com/taobao/tengine/blob/master/src/... If you want to use official nginx only, you can apply the patch below: @Maxim: Would you please consider to apply this patch to the trunk? Thanks in advance. Index: src/os/unix/ngx_files.c =================================================================== --- src/os/unix/ngx_files.c (revision 4942) +++ src/os/unix/ngx_files.c (working copy) @@ -363,7 +363,7 @@ { int n; - n = glob((char *) gl->pattern, GLOB_NOSORT, NULL, &gl->pglob); + n = glob((char *) gl->pattern, 0, NULL, &gl->pglob); if (n == 0) { return NGX_OK; Regards,
on 2012-11-28 13:23
Hello! On Wed, Nov 28, 2012 at 07:48:27PM +0800, Joshua Zhu wrote: > > For example we haven't defined a default vhost on each server... so nginx > > > > @Maxim: > Would you please consider to apply this patch to the trunk? Thanks in > advance. I've already proposed removing GLOB_NOSORT to Igor a while ago. His position on this is to keep this in sync with Windows version where there is no sort guaranties. [...] -- Maxim Dounin http://nginx.com/support.html
on 2012-11-28 13:27
> Hello! > I've already proposed removing GLOB_NOSORT to Igor a while ago. > His position on this is to keep this in sync with Windows version > where there is no sort guaranties. > > [...] Can't we just pass that as a config option so that the configure script detects the build environment and if were on *NIX the sorting is enabled? Thanks, --appa
on 2012-11-28 13:29
>> Hello! > >> I've already proposed removing GLOB_NOSORT to Igor a while ago. >> His position on this is to keep this in sync with Windows version >> where there is no sort guaranties. >> >> [...] > > Can't we just pass that as a config option so that the configure script > detects the build environment and if were on *NIX the sorting is enabled? s/were/we're/ --appa
on 2012-11-28 13:55
On 28.11.2012 14:23, Maxim Dounin wrote: > > I've already proposed removing GLOB_NOSORT to Igor a while ago. > His position on this is to keep this in sync with Windows version > where there is no sort guaranties. this just can be described in documentation as drawback of windows version of nginx, as many other "Known issues" and limitations at http://nginx.org/en/docs/windows.html because the UNIX version of nginx is the major and main stream. so the best possible capabilities must be present in UNIX version, not in windows one. and windows version must be compatible with UNIX version, if this is possible. now - capabilities of mainstream UNIX version artificially limited to be "compatible" with even not-production-ready windows version. this is very strange and unexpected and confusing for users of mainstream UNIX/Linux version of nginx (and this is more than 99% of all use cases of nginx) for example, windows 7 not support cache module and many other modules - but this is not reason for remove this feature from UNIX version of nginx. P.S. similar example: method java.io.File.renameTo (function "rename")works differently on Windows and UNIX, this is "Known issues" and can't be avoided in any case. btw, similar "rename bugs" and incompatibilities also must be presented also in windows/unix version of nginx http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4017593 java.io.File.renameTo has different semantics on Solaris and Win32 http://pubs.opengroup.org/onlinepubs/009695399/fun... rename -- Best regards, Gena
on 2012-11-28 15:16
Hello! On Wed, Nov 28, 2012 at 01:27:04PM +0100, Antonio P.P. Almeida wrote: > > Hello! > > > I've already proposed removing GLOB_NOSORT to Igor a while ago. > > His position on this is to keep this in sync with Windows version > > where there is no sort guaranties. > > > > [...] > > Can't we just pass that as a config option so that the configure script > detects the build environment and if were on *NIX the sorting is enabled? The codepath in question is unix-only, the question is about user experience which will be different on unix and win32 with GLOB_NOSORT removed on unix. Right now one can't rely on wildcard include ordering, and this is consistent for all platforms supported. And "listen ... default" should be used to mark default server if one uses wildcard include to include multiple server blocks listening on the same some ip:port. With the GLOB_NOSORT removed the behaviour will be different on unix (included files will be sorted) and win32 (included files are not guaranteed to be sorted), which is considered bad. (I personally think that GLOB_NOSORT should be removed anyway. I'll talk to Igor again about this.) -- Maxim Dounin http://nginx.com/support.html
on 2012-11-30 00:25
Hello! On Wed, Nov 28, 2012 at 06:15:50PM +0400, Maxim Dounin wrote: > > > [...] > should be used to mark default server if one uses wildcard include > to include multiple server blocks listening on the same some > ip:port. With the GLOB_NOSORT removed the behaviour will be > different on unix (included files will be sorted) and win32 > (included files are not guaranteed to be sorted), which is > considered bad. > > (I personally think that GLOB_NOSORT should be removed anyway. > I'll talk to Igor again about this.) I've discussed this with Igor, and this time he finnally approved removing GLOB_NOSORT. Committed, http://trac.nginx.org/nginx/changeset/4944/nginx Thanks to all for prodding this. -- Maxim Dounin http://nginx.com/support.html
on 2012-11-30 06:22
Hi, On Fri, Nov 30, 2012 at 7:25 AM, Maxim Dounin <mdounin@mdounin.ru> wrote: > Hello! [...] > > I've discussed this with Igor, and this time he finnally approved > removing GLOB_NOSORT. Committed, > Cool! Thanks :) Regards,
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.