Kill lui lei dog---linux no:38 linux under Nginx pathinfo support

Source: Internet
Author: User

We encounter a lot of problems when using thinkphp in Nginx, such as:

No permissions, this is the benefit of Linux Rights Management, we give him permission.

We give him permission to access the normal:

Then we add a lists method for the Indexcontroller controller:

Then we add a lists method, as follows:

Save exit. To visit her.

No ... Because Nginx does not support php behind the URL where there is a slash and followed by a string of parameters: So we have to find a way to get him to support PathInfo.

But let's start with the Apache test under Windows, create a file named: test.php, and the code looks like this:

<? PHP     Echo "<pre>";     Print_r ($_server);

Save and then visit her ...

It is clear that he has recognized it here.

Then we create a test.php in the Nginx HTML directory and the same file code as above, as follows:

The no arguments are as follows:

One plus parameter is an error, as shown below:

Our solution is to modify the nginx.conf file as follows:

        Location ~ \.php (. *) $ {            root           html;            Fastcgi_pass   127.0.0.1:9000;            Fastcgi_index  index. php;            Fastcgi_param  script_filename  /usr/local/nginx/html$fastcgi _script_name;            Fastcgi_param  path_info $1;             include         fastcgi_params;        }

You can then reset the configuration file under the Go directory.

./nginx-s Reload

Then visit the test test:

Ok,nginx has been perfectly supportive of pathinfo ...

Kill lui lei dog---linux no:38 linux under Nginx pathinfo support

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.