Syntax: | fastcgi_param |
---|---|
Default: | — |
Context: | http , server , location |
Sets a parameter
that should be passed to the FastCGI server. The value
can contain text, variables, and their combination. These directives are inherited from the previous level if and only if there are nofastcgi_param
directives defined on the current level.
设置到FastCGI服务的参数,它的值可以是文本,变量或者两者的结合,当且仅当在当前级别没有指定fastcgi-param参数时,这些指令会继承上一级的指令。
The following example shows the minimum required settings for PHP:
fastcgi_param SCRIPT_FILENAME /home/www/scripts/php$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string;
The SCRIPT_FILENAME
parameter is used in PHP for determining the script name, and the QUERY_STRING
parameter is used to pass request parameters.
SCRIPT_FILENAME参数在PHP中用来确定脚本名称,QUERY_STRING参数用来传输请求参数。
For scripts that process POST
requests, the following three parameters are also required:
对于处理post请求的脚本来说,接下来的三个参数是需要的。
fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length;
If PHP was built with the --enable-force-cgi-redirect
configuration parameter, the REDIRECT_STATUS
parameter should also be passed with the value “200”:
如果PHP编译的时候使用了--enable-force-cgi-redirect
指令,REDIRECT_STATUS参数应该传输200.
fastcgi_param REDIRECT_STATUS 200;
If the directive is specified with if_not_empty
(1.1.11) then such a parameter will be passed to the server only if its value is not empty:
fastcgi_param HTTPS $https if_not_empty;