FastCGI options

FastCGI parameters describe the request, target script, query string, and document root.

Target guide

FastCGI variables are the bridge between nginx or Apache and LaiRu FPM. The most important values are SCRIPT_FILENAME, DOCUMENT_ROOT, REQUEST_METHOD, QUERY_STRING, REQUEST_URI, and PATH_INFO. A wrong SCRIPT_FILENAME often looks like a missing file; a wrong DOCUMENT_ROOT can make safe includes and file operations resolve against the wrong boundary.

Parameters

SCRIPT_FILENAME
Absolute path to the LaiRu script that should execute.
DOCUMENT_ROOT
Absolute path to the web root for the site.
PATH_INFO
Extra route path after the script name, used by front controllers and routers.
REQUEST_URI
Original request URI as seen by the web server.
QUERY_STRING
Raw query string without the leading question mark.
REQUEST_METHOD
HTTP method such as GET or POST.

Examples

Working pattern

1fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;2fastcgi_param DOCUMENT_ROOT $document_root;
Use this as a focused starting point and adapt it in context.

Minimum FastCGI variables

1fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;2fastcgi_param DOCUMENT_ROOT $document_root;3fastcgi_param REQUEST_METHOD $request_method;4fastcgi_param QUERY_STRING $query_string;5fastcgi_param REQUEST_URI $request_uri;6fastcgi_param PATH_INFO $fastcgi_path_info;
These values let the runtime identify the target script, the request method, the query string, and the web root boundary.

Related