-1

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' があります。

私が間違っていることは何ですか?

thnx

UPD: 書き換えルールは $document_uri のみを書き換え、$request_uri は書き換えないようです。したがって、$_SEVER['REQUEST_URI'] == '/rest/process' および $_SEVER['DOCUMENT_URI'] == '/process'

4

1 に答える 1

0

リライトを次のように変更する必要があると思います。

rewrite ^/rest/(.+)$ $scheme://$host/$1;
于 2012-11-04T13:37:53.887 に答える