HowTo: Fix nginx not reloading with long gzip_types lines

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.

Over 1 year ago