Don't understood case sensitive and case none sensitive

I am still trying to learn Nginx.

I run Nginx with Debian Nginx V1.26.3.
My current understanding is, that ~ means case sensitive and ~* case insensitive.

location ~* ^/(phpadmin|test|public)/ }
....
}

should work each kind of TeSt. But it works only with test!
Can anybody explain me, what I have done in the wrong way?

1 Like

Hi @HGA!

Your understanding is correct! But there might be some typo in your config. I created a short config sample that shows how to create a location block similar to yours here https://tech-playground.com/snippet/mighty-stoic-woodlouse/.

Good Morning (@alessandro),

I guess you are right, something is wrong with my configuration, but I don’t thing, it’s an typing error! This is the part of my configuratin, based on the default!

location ~* ^ /(phpmyadmin|test|public)/ {
alias /var/www/html/;
index index.php index.html;
location \.php$ {
…….
}
}

have made some tests.

  1. I add a $ behind last / in the first line
  2. I replaced the last / in the first line with the $
    The result for both, I always got a 404.
    Before there are only a root, index and server_name. So I guess the proble must be in another configuration file.

Hi @alessandro ,
I have looked into the /etc/nginx/nginx.conf file and find out that my file country-radio.eu is 5 times included into the nginx.file!
I guess, that is not alright!

But why?

Do you have an idea?

After run “nginx -s reload” I see the “nginx.conf” file without the country-radio.eu config file.
But case insensitive is stlii not working!
I am a little bit confused!

Hey again!

Couple things:

  • country-radio.eu has nothing to do with NGINX or NGINX’s config. No idea where it comes from, but if it was included multiple times, it’s probably something on your end?
  • If you look at my example you’ll see case insensitive working as intended. If you recreate it it really should work on your end. If it isn’t, the issue is likely somewhere else in your config.