简体   繁体   English

Nginx将参数传递到PHP文件

[英]Nginx passing parameters to a PHP file

I'm trying to pass all the requests that hits a specific location , to a PHP file with the request URL via Nginx config file, I've almost done this but I cannot pass the URL to the PHP file. 我正在尝试通过Nginx配置文件将命中特定位置的 所有请求传递具有请求URLPHP文件,我几乎已经做到了,但是我无法将URL传递给PHP文件。

I've tried var_dump($_REQUEST); var_dump($_ENV); var_dump($argv); 我已经尝试过var_dump($_REQUEST); var_dump($_ENV); var_dump($argv); var_dump($_REQUEST); var_dump($_ENV); var_dump($argv); but returns NULL or emtpy array results. 但返回NULL或emtpy数组结果。

location /p/ {

     try_files $uri $uri/ @php;         
}

location @php {
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/process/internal/t.php; # this script catches all requests
        fastcgi_param  QUERY_STRING $uri;
        include fastcgi_params;
}

Try to move the include fastcgi_params; 尝试移动include fastcgi_params; higher, above the fastcgi_param s 更高,高于fastcgi_param

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM