Enter Nginx directory and open nginx.conf
For example, the URL of my visit to thinkphp is (TP5 is the directory I created under nginx/html/, called the level Two directory below): Https://192.168.139.128/tp5/index.php?s=index/index/index
PathInfo mode is not supported now
1, let Nginx support PathInfo mode, you can access Url:https://192.168.139.128/tp5/index.php/index/index/index
Will
Location ~ \.php$ {
root html;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
I
Nclude Fastcgi_params;
}
Modified into
Location ~ \.php ($|/) {
root html;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_split_path_info ^ (. +\.php) (. *) $;
Fastcgi_param path_info $fastcgi _path_info;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Include fastcgi_params;
}
2, followed by the hiding out index.php
This code is added so that you don't need to enter index.php:https://192.168.139.128/tp5/index/index/index in the URL
Location/{
root html;
Index index.php index.html index.htm;
if (!-e $request _filename) {
# # #一级目录下
#rewrite ^/(. *) $/index.php/$1 last;
# # #域名下的二级目录
rewrite ^/tp5/(. *) $/tp5/index.php/$1 last;
}
}
3, restart Nginx