Recently a TP5 project said put to Nginx under test see, Download a phpstudy, put to www, configure good domain name, directly to a newspaper 404;
Workaround:
1. First configure the domain name directory under the Phpstudy under the public under the project;
2. Copy the following code into the Nginx/conf/vhost file:
Location/{
Index index.html index.htm index.php;
#autoindex on;
if (!-e $request _filename) {
Rewrite ^ (. *) $/index.php?s=/$1 last;
Break
}
}
The code is as follows:
3. Restart Nginx, the above code is also mentioned in the deployment of the TP5 manual;
4. What is red above?
When visiting the website, Nginx will find files in the root directory in the order of index.html,index.htm, index.php. If none of the three files exist, then Nginx returns 403 Forbidden.
Therefore, in Vhost without this content directly enter the domain name access will be reported 403 error, unless you add a/index.php after the domain name to be able to access the normal;
Thinkphp+nginx (phpstudy) 404 error, 403 error resolution