Nginx + thinkphp solves the problem of not supporting pathinfo mode and various 404,500 problems. nginxpathinfo_PHP tutorial

Source: Internet
Author: User
Nginx + thinkphp solves the problem of not supporting pathinfo mode and various 404,500 problems, nginxpathinfo. Nginx + thinkphp solves the problem of not supporting pathinfo mode and various 404,500 problems. The nginxpathinfonginx environment problem occurred for two days. it was found that many posts on the Internet were either copied or pasted, nginx + thinkphp is required to solve the problem of not supporting pathinfo mode and various 404,500 problems. nginxpathinfo

After two days of nginx environment problems, I found that many posts on the Internet were either copied and pasted, or they did not close the post. I also wrote a sentence like "haha, I solved it myself, in this case, I despise the people who post these posts. if you ask a question, you will not be able to give an explanation if the problem is solved. I am still searching for the first few pages. I have never thought about the feelings of people who need answers. Looking at the answer with joy, I found that there was no ending post. Okay, let's just move on to the topic.

In this way, you do not need to change URL_Model to rewrite/compatible:

There are about 43rd lines. modify the code according to the following. pay attention to the symbols in detail:

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

If (! -E $ request_filename ){
Rewrite ^/(. *) $/index. php/$1 break;
Break;
}

}

In the php configuration, set location ~ \. Php $ changed to location ~ \. Php, emphasize again, pay attention to the details, removed here$Symbol, which is why I failed to solve it at the beginning.

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 $1;
Set $ path_info $2;
}
Fastcgi_param SCRIPT_FILENAME $ document_root $ real_script_name;
Fastcgi_param SCRIPT_NAME $ real_script_name;
Fastcgi_param PATH_INFO $ path_info;
}

If the problem persists, add the configuration define ('_ PHP_FILE _', $ _ SERVER ['script _ name']) to the index. php file of the ThinkPHP Portal.

During this period, you may encounter 500,404 of problems, but remember to be careful. As long as you follow this change, there is basically no problem. If you have any questions, please leave a message.

Solution 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 problem with the ingress nginx environment has been solved for two days. I found that many posts on the Internet are either copied and pasted...

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.