我有 nginx + php-fpm,当我尝试访问“/rest/proccess”时,我想要 $_SEVER['REQUEST_URI'] == '/process'。所以我刚刚为 nginx 创建了这样的配置:
location /rest/ {
root /var/www/php;
rewrite ^/rest/(.*)$ /$1 break;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
include fastcgi_params;
}
但它不起作用,在 php 中我有 $_SEVER['REQUEST_URI'] == '/rest/process'。
我做错了什么?
谢谢
UPD:似乎重写规则只重写了 $document_uri,而不是 $request_uri,所以 $_SEVER['REQUEST_URI'] == '/rest/process' 和 $_SEVER['DOCUMENT_URI'] == '/process'