.

Tweak Nginx to Serve Longer Domain Names - VPS Bible #15

English   English (change)
  • Digg
  • Twitter
  • Technorati
  • del.icio.us
  • Facebook
  • MySpace
  • Reddit
  • StumbleUpon
  • LinkedIn
  • email

EDIT/INCREASE server_names_hash_bucket_size

server-names-hash-bucket image

If you're using nginx, and your domain name exceeds 32 characters, you may receive an error message when you restart the web server.

Quite likely, you need to tell nginx to allow for longer domain names.

To do so, open your config file. For you installed Nginx using a package manager, you can access this with:-

Set Up an Unmanaged VPS (4 Newbies) .. The V-P-S Bible

In 20 copy/paste steps .. from zero to hero, blank box to cute-as Linux server.

Scroll down for the full series index.

So, hey, shed shared & viva virtual!   Hope it helps.   the_guv

sudo nano /etc/nginx/nginx.conf

For others, who compiled from source:-

sudo nano /usr/local/nginx/conf/nginx.conf

.. and in there, within the http section, that looks like this ..

http {
#various settings here
}
Just add this line:-
server_names_hash_bucket_size 64;

Save the file.

Reboot nginx:-

sudo /etc/init.d/nginx restart

And your longer domain name should work. If the name is longer than 64 characters, swap the '64' value for 128, but I pity your users :)


If you liked that ...
... maybe you'll like these?

.