Linux – How serve files in folder with case insensitive on linux with nginx

case-insensitivelinuxnginx

I'm having a little problem. I need serve files with case insensitive for a folder, i use nginx:

Original:
https://example.com/media/catalog/product/b/t/bt2501_brandy.jpg
https://example.com/media/catalog/product/p/r/PR3027GUN_1.JPG

This picture above would works with this way (case insensitive):
https://example.com/media/catalog/product/b/t/BT2501_BRANDY.jpg or
https://example.com/media/catalog/product/b/t/bt2501_Brandy.jpg or
https://example.com/media/catalog/product/b/t/bt2501_Brandy.JPG
https://example.com/media/catalog/product/p/r/pr3027gun_1.JPG

Some idea for me?

I know linux is case sensitive. But i can deal with this with nginx?

Thanks

Best Answer

location ~* ^/media/catalog/product/ {
    # The tilde and asterisks ensure that this location will
    # be matched case insensitive. nginx does not support
    # setting absolutely everything to be case insensitive.
    # The reason is easy, it's costly in terms of performance.
}