Mobile app version of vmapp.org
Login or Join
Voss4911412

: In NginX what means location ^~ If I'm not wrong, location = / {} means "only the / folder, not the files inside, not the subfolders" location ~ / {} means "the / folder, all the files inside,

@Voss4911412

Posted in: #Htpasswd #Nginx #Php

If I'm not wrong,
location = / {} means "only the / folder, not the files inside, not the subfolders"
location ~ / {} means "the / folder, all the files inside, all the subfolders and their subfiles"
But what it means:
location ^~ / {}?I found this configuration in the web, but I wasn't able to google an answer.
I found it in a tutorial while I was trying to protect with htpasswd a folder and everything inside of it. However location ~ / did the job, while even if location ^~ / protected everything as well, it did not let the php pages to work correctly.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Voss4911412

1 Comments

Sorted by latest first Latest Oldest Best

 

@Lee4591628

Quote from nginx documentation:


If the longest matching prefix location has the “^~” modifier then regular expressions are not checked.


So, if the location matches / location, then locations using regex aren't evaluated. This causes the effect you described, that is, PHP scripts stop working, because PHP scripts are generally defined using a regex location block.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme