Welcome! Log In Create A New Profile

Advanced

Re: Random order of configuration file reading

All files from this thread

File Name File Size   Posted by Date  
include-sorted.patch 395 bytes open | download Joshua Zhu 11/28/2012 Read message
Joshua Zhu
November 28, 2012 06:50AM
Hi,

On Tue, Nov 27, 2012 at 10:07 PM, philipp <nginx-forum@nginx.us> wrote:

> 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.)
>

This is a known issue. It has been fixed in our own
Tenginehttp://tengine.taobao.org
distribution:
https://github.com/taobao/tengine/blob/master/src/os/unix/ngx_files.c#L362

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,

--
Joshua Zhu
Senior Software Engineer
Server Platforms Team at Taobao
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Attachments:
open | download - include-sorted.patch (395 bytes)
Subject Author Posted

Random order of configuration file reading

philipp November 27, 2012 09:07AM

Re: Random order of configuration file reading Attachments

Joshua Zhu November 28, 2012 06:50AM

Re: Random order of configuration file reading

Antonio P.P. Almeida November 28, 2012 07:28AM

Re: Random order of configuration file reading

Antonio P.P. Almeida November 28, 2012 07:30AM

Re: Random order of configuration file reading

Maxim Dounin November 28, 2012 09:16AM

Re: Random order of configuration file reading

Maxim Dounin November 29, 2012 06:26PM

Re: Random order of configuration file reading

Joshua Zhu November 30, 2012 12:24AM

Re: Random order of configuration file reading

Gena Makhomed November 28, 2012 07:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 160
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready