check NGINX version at configuration file level

Viewed 31

Is there a constant that holds the nginx version (and which format is used) I can access from the configuration file to set conditional options based on the detected version?

Edit: this was an easy one... $nginx_version

However I'm stuck again:

in an http block I have:

    if $nginx_versionĀ ~ .*1\.22.*
    {
        server_names_hash_bucket_size: 64;
    }

older but it complains I cannot use if there

I have two different nginx instances running on two separate servers, the older one doesn't understand server_names_hash_bucket_size

It's not time to upgrade and align the two severs.

But it would convenient for me to use the same config

0 Answers
Related