Thinkphp+nginx (phpstudy) 404 error, 403 error resolution

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.