Recently a TP5 project said put to Nginx under the test to see, download a phpstudy, put to the WWW, configure a good domain name, directly to the newspaper a 404;
Workaround:
1. First in the Phpstudy under the configuration of the domain name directory point under the project under public;
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 screenshot is as follows:
3. Restart the Nginx, the above code is also mentioned in the deployment of the TP5 manual;
4. What is red above?
When you visit the Web site, Nginx looks for files in the root directory in index.html,index.htm, index.php order. If none of the three files exists, then Nginx will return to 403 forbidden.
Therefore, in Vhost without this content directly enter the domain name Access will report 403 error, unless you add a/index.php after the domain name can be normal access; Tags: PHP