Claus-Theodor Riegg
8 years
Andreas Vöst
2 years
Andreas Vöst
2 years
Moritz Kraus
2 years
Emma Heinle
2 years
Emma Heinle
3 years
Claus-Theodor Riegg
4 years
Claus-Theodor Riegg
4 years

HowTo: Fix nginx not reloading with long gzip_types lines

Posted . Visible to the public.

When using many or very long entries of MIME-types that shoudl be gziped in gzip_types directives in nginx you might not be able to successfully reload the service and get this error message instead:

nginx: [emerg] could not build the test_types_hash, you should increase test_types_hash_bucket_size: 64
nginx: configuration file /etc/nginx/nginx.conf test failed

Option 1: Use gzip_types *;

If you don't care about which MIME type gets the gzip handling, just tell nginx that any MIME type should be gziped.

Especially for assets which might change, this is often the more sensible solution.

Option 2: Add types_hash_bucket_size Show archive.org snapshot

If you need to have only very specific, but still very long gzip_types you should just add types_hash_bucket_size Show archive.org snapshot to the location that causes the issue and increase it to a value that satisfies your needs.

Marius Schuller
Last edit
Emma Heinle
Tags
License
Source code in this card is licensed under the MIT License.