Adjusting server_names_hash_bucket_size before nginx throws an error

Vladimir Kozyrev v.kozyrev.sa at gmail.com
Thu Jan 12 20:28:53 UTC 2017


What a relief! Thanks Maxim!

On Thu, Jan 12, 2017 at 6:38 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:

> Hello!
>
> On Thu, Jan 12, 2017 at 03:12:30PM +0300, Vladimir Kozyrev wrote:
>
> > My issue is that I add server {} and upstream {} directives dynamically
> to
> > /etc/nginx/conf.d/dynamic_vhost.conf.
> > Once the file grew, nginx stopped working and I increased
> hash_bucket_size
> > parameter to make it work again.
> > Is there a way to calculate what value should I set to hash_bucket_size
> > parameter for a given number of server {} and upstream {} directives? At
> > some point, the file will grow big enough to stop nginx from working once
> > again.
> > Any advice on how can I prevent that from happening will be appreciated.
>
> The value of server_names_hash_bucket_size limits the maximum
> length of a server_name used.  If you use long server names, set
> it to the maximum name length expected (plus some additional space
> for two pointers).
>
> Everything else is not fatal when constructing hashes since nginx
> 1.5.13.  If nginx fails to build an optimal hash with bucket_size
> and max_size configured, it simply ignores bucket_size and logs an
> appropriate warning (non-fatal).
>
> Some additional information about configuring hashes can be found
> at http://nginx.org/en/docs/hash.html.
>
> --
> Maxim Dounin
> http://nginx.org/
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170112/deb5d53e/attachment.html>


More information about the nginx mailing list