Score:0

Nginx: could not build map_hash, you should increase map_hash_bucket_size: 64 even when its set under http (stream module used)

ye flag

since I can only ask questions here but its more of a solution for other people that have this issues I hope its still fine to be posting here, I didnt know a better place since I don't own a website or anything.

After updating our nginx we use with the stream module to 1.24.0 today in our company we faced the issues on how to increase the size of the map_hash_bucket_size. Every other answer to a seemingly similar question says to write this parameter under the "http", which gets ignored apparently if you use the stream module? I couldn't verify that.

For us in the end the solution we got from just testing where the parameter works for us was to write the paramter under "stream":

http {
    server {
        listen 80;
        server_name _;
        return 301 https://$host$request_uri;
      }
    }

    stream {
        map_hash_bucket_size 128;
        map $ssl_preread_server_name $name {
            redacted.company.domain.local upstream_development_https;
            ...
    }

Hope this helps anyone in the future with an edgecase like ours.

Richard Smith avatar
jp flag
[The documentation](http://nginx.org/en/docs/stream/ngx_stream_map_module.html#map_hash_bucket_size) states where a directive must be placed in the "Context:" section of the summary block.
anx avatar
fr flag
anx
Is there anything you would like additional answers on? It looks like part of what is now in the *question* section should be in the *answer* section. See also [Help center > Can I answer my own question?](https://serverfault.com/help/self-answer)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.