Regular Expression 正規化

Regular Expression 正規化

https://www.unicloud.com/analytics

server {

    ...
    ...

    location ~ ^/analytics/.+\.php$ {
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME /var/www/gpd.admin/analytics/public/index.php;
        include        fastcgi_params;
    }

    location ~^/analytics($|/.*) {
        alias       /var/www/gpd.admin/analytics/public/;
        index       index.php index.html index.htm;
        try_files $uri $uri/ /analytics/index.php;
    }

    ...
    ...
}
  • ~ 大小写敏感匹配

  • ~* 大小写不敏感匹配

  • ^ 開頭字元

  • $ 結尾字元

  • .+ 任意1~N字元

  • () 一組 sub pattern

  • | 或是

Question

如果訪問的網址是:

Last updated