nginx: could not build the server_names_hash

I’ve recently started switching my custom nginx installations to the Debian repository version.

So from 0.9.4 to 0.6.32 (Lenny), which will be upgraded to 0.7.x in Squeeze.

I’ve come across this error on certain servers:

# /etc/init.d/nginx restart
Restarting nginx: 2011/02/11 11:34:58 [emerg] 3624#0: could not build the server_names_hash, 
you should increase server_names_hash_bucket_size: 32

This can be solved by adding this to the nginx.conf:

server_names_hash_bucket_size 64;

Be sure to place it between the http-section.

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    server_names_hash_bucket_size 64;

    access_log	/var/log/nginx/access.log;
    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    tcp_nodelay        on;
    tcp_nopush	       on;

    gzip  on;
    gzip_comp_level   5;
    gzip_http_version 1.0;
    gzip_min_length   0;
    gzip_proxied      any;
    gzip_buffers      16 8k;
    # Some version of IE 6 don't handle compression well on some mime-types, 
    # so just disable for them
    gzip_disable "MSIE [1-6].(?!.*SV1)";
    gzip_types        text/plain text/css image/x-icon application/x-javascript text/xml  application/xml application/xml+rss text/javascript image/gif image/jpeg image/png application/json application/x-tar application/zip application/x-rar-compressed application/msword application/octet-stream application/ application/pdf application/;
    gzip_vary         on;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

Posted by


, ,


Leave a Reply…