Thinkphp support PathInfo method sharing under the low version nginx, nginxpathinfo_php tutorial

Source: Internet
Author: User
Tags nginx server

Thinkphp supports PathInfo method sharing under the lower version of Nginx, Nginxpathinfo


Recently in the use of thinkphp to do a project, the basic completion of deployment to the Nginx server only to find that Nginx is not supported pathinfo so how do we handle it.

Nginx Environment

In Nginx low version, PathInfo is not supported, but can be passed in nginx.conf (in/usr/local/nginx/conf/nginx.conf or through Find/| grep nginx.conf to find the location) in configure the forwarding rule implementation: Add in nginx config file:

Location/{if ' (!-e $request _filename) {   rewrite ^ (. *) $/index.php?s=$1 last;   

In fact, the internal is forwarded to the thinkphp provided by the compatibility mode URL, in this way, you can solve other non-support PathInfo Web server environment.
If your thinkphp is installed in a level two directory, the Nginx pseudo-static method is set as follows, where Youdomain is the directory name in which it resides.

location/youdomain/{if (!-e $request _filename) {  

Such as:

location/thinkphp/{if (!-e $request _filename) {    rewrite ^/thinkphp/(. *) $/thinkphp/index.php?s=$1 last;}}

Syntax: Rewrite regex replacement flag (last equivalent to the [L] tag inside Apache, indicating rewrite. )

http://www.bkjia.com/PHPjc/1133067.html www.bkjia.com true http://www.bkjia.com/PHPjc/1133067.html techarticle thinkphp in the lower version of Nginx support PathInfo method sharing, Nginxpathinfo recently in a project with thinkphp, basically completed after the deployment to the Nginx server only to find Nginx is not supported ...

  • Related Article

    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.