The first time you install Nginx, the installation is complete and the thinkphp is found to be unable to run. After consulting the relevant information, it is resolved by the following methods:
Configure Nginx PathInfo Support:
After the original configuration is complete:
#location ~ \.php$ {
# root E:/www;
# Fastcgi_pass 127.0.0.1:9000;
# Fastcgi_index index.php;
# Fastcgi_param Script_filename E:/www$fastcgi_script_name; # Fastcgi_param Path_info E:/www$fastcgi_script_name;
# include Fastcgi_params;
#}
Increase the configuration results after PathInfo:
Location ~ \.php ($|/) {roote:/www; set $script $uri; set $path _info ""; if ($uri ~ "^ (. +\.php) (/.+)") {set $script $; set $path _info $} fastcgi_pass 127.0.0.1:9000; Include Fastcgi_params; Fastcgi_param path_info $path _info; Fastcgi_param Script_filename E:/www$script; Fastcgi_param Script_name $script; }
Add thinkphp Hide index.php support:
If the entry file is in a subdirectory:
Location/{
Root e:/www;
Index index.html index.php index.htm;
if (!-e $request _filename) {
Rewrite ^/subdirectory/(. *) $/subdirectory/index.php?s=$1 last;
Break
}
}
If the portal file is in the Web directory:
Location/{
Root e:/www;
Index index.html index.php index.htm;
if (!-e $request _filename) {
Rewrite ^ (. *) $/index.php?s=$1 last;
Break
}
}
Finish the call.