LNMP ThinkPHP5 Open PathInfo support ____php

Source: Internet
Author: User

My code in the WNMP environment is running normally, but in the LNMP environment found that ThinkPHP5 pathinfo failure, resulting in route:rule also can not use. Even according to the official website to add some code is only useful home page, click on other pages may still cause 404 or 500 errors. The following solutions were finally found. Finally, I'll post my configuration 1. Modify the/usr/local/php/etc/php.ini file

Search cgi.fix_pathinfo=0, change its value to 1

2. Modify/usr/local/nginx/conf/nginx.conf (or vhost) files

Add to

        include/usr/local/nginx/conf/enable-php-pathinfo.conf;
        Location/{
            index  index.html index.htm index.php l.php;
            AutoIndex off  ;

            if (!-e $request _filename) {
            rewrite  ^ (. *) $  /index.php?s=/$1 last  ;
            }
        }
3. Nginx Reload configuration file

Nginx-s relaod

Here's my profile.

 server {Listen 80;

        server_name Www.vm2phplive.io;
        Root "/home/wwwroot/phplive/public";
        include/usr/local/nginx/conf/enable-php-pathinfo.conf;
            Location/{index index.html index.htm index.php l.php;

            AutoIndex off;
            if (!-e $request _filename) {rewrite ^ (. *) $/index.php?s=/$1 last; } # REDIRECT Server error pages to the static page/50x.html # Error_page 500 502 50
        3 504/50x.html;
        Location =/50x.html {root html; }

    }

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.