Nginx+thinkphp solution does not support the PathInfo mode and the existence of a variety of 404,500 issues

Source: Internet
Author: User
Tags zend
Nginx environmental problems for two days, found online a lot of people's posts are either copied or pasted, or there is no knot paste, but also write their own "Haha, I solve their own" and so on, I despise these postings of compatriots, you said you asked questions, the problem solved also do not give an explanation. Still on the first few pages of the search, think about the feelings of people who need answers. Full of joy to see the answer, found there is no knot paste. Well, don't say more, get to the point.

I do not need to change Url_model to rewrite/compatible in this way:

About line 43rd, follow the following code to make changes, please note the details of the symbol:

Location/{
Root c:/zend/workspaces; #//This is the root directory of your own project.
Index index.html index.htm index.php;

if (!-e $request _filename) {
Rewrite ^/(. *) $/index.php/$1 break;
Break
}

}

In the PHP configuration, the location ~ \.php$ to location ~ \.php, again stressed, attention to detail, here to remove the $ symbol, I just started because of this reason has not been able to solve.

Location ~ \.php {
Root c:/zend/workspaces;
Fastcgi_pass 127.0.0.1:9000;
Fastcgi_index index.php;
Fastcgi_param Script_filename C:/wnmp/php$fastcgi_script_name;
Include Fastcgi_params;
Set $path _info "";
Set $real _script_name $fastcgi _script_name;
if ($fastcgi _script_name ~ "^ (. +?\.php) (/.+) $") {
Set $real _script_name $;
Set $path _info;
}
Fastcgi_param script_filename $document _root$real_script_name;
Fastcgi_param script_name $real _script_name;
Fastcgi_param path_info $path _info;
}

If it is still unresolved, add the configuration define (' _php_file_ ', $_server[' script_name ') to the thinkphp portal file index.php;

You may encounter 500,404 of problems during the period, but remember one thing and be careful. As long as I change this, basically no problem. If you have any questions, please contact us.

Workaround Source Reference: Http://www.codesth.com/%E4%B8%8D%E7%94%A8rewrite%E5%85%BC%E5%AE%B9%EF%BC%8C%E8%A7%A3%E5%86%B3nginx%E4 %b8%8d%e6%94%af%e6%8c%81thinkphp-pathinfo%e6%a8%a1%e5%bc%8f/

The above describes the nginx+thinkphp solution does not support the PATHINFO model and the existence of a variety of 404,500 issues, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.