Solve ThinkPHP's inability to use pathin in Nginx.

Source: Internet
Author: User
[Environment] Ubuntu120432bitAMH panel 42Nginx144PHP5327ThinkPHP312 ----------------------------------- not very gorgeous split line --------------------------------- is actually directly writing rewri

[Environment]

Ubuntu 12.04 32bit

AMH panel 4.2

Nginx 1.4.4

PHP 5.3.27

ThinkPHP 3.1.2


--------------------------------- Not very gorgeous split line ---------------------------------


In fact, the rewrite file is directly written. I don't know the specific syntax of Baidu. I just barely finished it after half-copy and half-modify the file on the internet. the rewrite content is released below:

Note: I directly configure the Nginx virtual host on AMH, so the path may be different.

Before writing a rewrite statement, set the location in the corresponding website configuration under the original vhost ~ * \. Php $ {} comment or delete the entire file (pay attention to backup !!)


Location /{

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

Location ~ . * \. Php
{
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_pass unix:/tmp/php-cgi-myar.kollway.com.sock;
Fastcgi_index index. php;
Include fcgi-host.conf;
Fastcgi_param DOCUMENT_ROOT/web $ subdomain;
Fastcgi_param SCRIPT_FILENAME/web $ real_script_name;
Fastcgi_param PATH_INFO $ path_info;

}


--------------------------------- Not very gorgeous split line ---------------------------------


References:

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/


Http://blog.csdn.net/realghost/article/details/9082847

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.