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;