I searched a lot of methods on the Internet but didn't work. After researching for a day, I found that the situation of 'URL_MODEL' => 2 can be perfectly supported through the following configuration
Copy code The code is as follows:
location /project/ {
index index.php;
if (!-e $request_filename) {
rewrite ^/project/(.*) $ /project/index.php/$1 last;
break;
}
}
location ~ .+.php($|/) {
set $script $uri ;
set $path_info "/";
if ($uri ~ "^(.+.php)(/.+)") {
set $script $1;
set $path_info $2 ;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php?IF_REWRITE=1;
include /APMServ/nginx/conf/fastcgi_params;
fastcgi_param PATH_INFO $path_info ;
fastcgi_param SCRIPT_FILENAME $document_root/$script;
fastcgi_param SCRIPT_NAME $script;
}
Here, all requests under the project are forwarded to index.php for processing. That is, the single entry file of ThinkPHP; then the request for the php file is handed over to fastcgi for processing, and support for PATH_INFO is added.
After restarting Nginx, URLs such as http://localhost/project/Index/insert and http://localhost/project/index.php/Index/delete can be accessed correctly.
Another thing to note is that there must be a space between if and the following brackets in the Nginx configuration file, otherwise an unknown directive error will be reported.
http://www.bkjia.com/PHPjc/324017.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/324017.htmlTechArticleI searched many methods on the Internet but none worked. After researching for a day, I found that the following configuration can perfectly support 'URL_MODEL' = 2, copy the code as follows: location /project/ { i...