Regarding nginx location matching issues
迷茫
迷茫 2017-05-16 17:09:23
0
1
473

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?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(1)
我想大声告诉你
  • 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.

  • The beginning of
  • ^~ means that the uri starts with a regular string, not a regular match

  • The beginning of
  • ~ 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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!