First, execute
Touch/usr/local/nginx/CONF/pathinfo. conf create the pahtinfo. conf file
Add the following content to the file:
Set $ real_script_name $ fastcgi_script_name;
If ($ fastcgi_script_name ~ "(. +? \. Php )(/.*)"){
Set $ real_script_name $1;
Set $ path_info $2;
}
Fastcgi_param script_filename $ document_root $ real_script_name;
Fastcgi_param script_name $ real_script_name;
Fastcgi_param path_info $ path_info ~ . * \. (PhP | PhP5 )? $ Replace with: Location ~ . * \. Php
Add a line of include pathinfo. conf in include fcgi. conf;
Restart nginx
The complete VM configuration file is as follows:
Server
{
Listen 80;
SERVER_NAME iw3c.com;
Index index.html index.htm index. php;
Root/home/wwwroot/iw3c;
Location ~ . * \. Php
{
Try_files $ uri = 404;
Fastcgi_pass Unix:/tmp/php-cgi.sock;
Fastcgi_index index. php;
Fcinclude gi. conf;
Include pathinfo. conf;
}
Location/status {
Stub_status on;
Access_log off;
}
Location ~ . * \. (GIF | JPG | JPEG | PNG | BMP | SWF) $
{
Expires 30d;
}
Location ~ . * \. (JS | CSS )? $
{
Expires 12 h;
}
}
Lnmp1.0 supports pathinfo Mode