This article to share the content is about PHP nginx server configuration Support PathInfo, has a certain reference value, the need for friends can refer to
The first method:
Modification of Nginx configuration not seen nginx.conf
Location ~ \.php { Fastcgi_pass 127.0.0.1:9000; Fastcgi_index index.php; include/usr/local/etc/nginx/fastcgi.conf; Set $real _script_name $fastcgi _script_name; if ($fastcgi _script_name ~ "^ (. +?\.php) (/.+) $") { set $real _script_name $; Set $path _info; } Fastcgi_param script_filename $document _root$real_script_name; Fastcgi_param script_name $real _script_name; Fastcgi_param path_info $path _info; }
If you do not need to modify the fastcgi.conf configuration file for a specific host, do not forget to reload the Nginx configuration
The second method:
The nginx.conf code is as follows:
Location ~ [^/]\.php (/|$) { #fastcgi_pass remote_php_ip:9000; Fastcgi_pass Unix:/dev/shm/php-cgi.sock; Fastcgi_index index.php; Include fastcgi.conf; Set $real _script_name $fastcgi _script_name; if ($fastcgi _script_name ~ "^ (. +?\.php) (/.+) $") { set $real _script_name $; Set $path _info; } Fastcgi_param script_filename $document _root$real_script_name; Fastcgi_param script_name $real _script_name; Fastcgi_param path_info $path _info; }
The fastcgi.conf code is as follows:
Fastcgi_param script_filename $document _root$fastcgi_script_name;fastcgi_param query_string $query _STRING;FASTC Gi_param request_method $request _method;fastcgi_param content_type $content _type;fastcgi_param content_length $content _length;fastcgi_param script_name $fastcgi _script_name;fastcgi_param request_uri $request _uri ; Fastcgi_param Document_uri $document _uri;fastcgi_param document_root $document _root;fastcgi_param SERVER_PR Otocol $server _protocol;fastcgi_param request_scheme $scheme fastcgi_param HTTPS $https if_not_empty ; Fastcgi_param gateway_interface cgi/1.1;fastcgi_param server_software nginx/$nginx _version;fastcgi_param REMOTE_AD DR $remote _addr;fastcgi_param remote_port $remote _port;fastcgi_param server_addr $server _ADDR;FASTC Gi_param server_port $server _port;fastcgi_param server_name $server _name;# PHP only, required if PHP is b Uilt with--enable-force-cgi-redirectfastcgi_param Redirect_status 200;
Reload Nginx:
Nginx-s Reload