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

Source: Internet
Author: User

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

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.