• 空格:默认匹配,普通匹配

      1. location / {
      2. root /home;
      3. }
    • =:精确匹配

      1. location = /imooc/img/face1.png {
      2. root /home;
      3. }
    • ~*:匹配正则表达式,不区分大小写

      1. #符合图片的显示
      2. location ~* .(GIF|jpg|png|jpeg) {
      3. root /home;
      4. }
    • ~:匹配正则表达式,区分大小写

      1. #GIF必须大写才能匹配到
      2. location ~ .(GIF|jpg|png|jpeg) {
      3. root /home;
      4. }
    • ^~:以某个字符路径开头

      1. location ^~ /imooc/img {
      2. root /home;
      3. }