When configuring nginx to support php-fpm, I found a problem, configure it as shown below
It is no problem to access http://host/server.php at this time
But when I removed it
As shown in the picture
There is a problem accessing http://host/server.php at this time
Please tell me why there must be a ~ number
My original understanding was that the uri /server.php can match location php and the matching length is longer than location / (3:1), so in this case it is the same whether there is ~ or not, but the result is unexpected
Please tell me, God, what is going on?
Start with = to indicate an exact match
For example, A only matches requests at the end of the root directory, and cannot be followed by any string.
^~ means that the uri starts with a regular string, not a regular match
~ indicates case-sensitive regular matching;
~* starts with case-insensitive regular matching
/ Universal matching, if there is no other match, any request will be matched
I’ve never seen anything like yours that doesn’t fit the bill.
Refer to nginx configuration location summary and rewrite rule writing