1. 程式人生 > >nginx 下 thinkphp 502 bad Gateway + "LNMP一鍵安裝包的Nginx 502 Bad Gateway錯誤可能原因及解決方法"

nginx 下 thinkphp 502 bad Gateway + "LNMP一鍵安裝包的Nginx 502 Bad Gateway錯誤可能原因及解決方法"

參考: http://lnmp.org/faq/lnmp-Nginx-502-Bad-Gateway.html

如果是非上述原因:

請找到nginx.conf中 找到這一行 include enable-php.conf; 

然後開啟 include enable-php.conf; 看看 加入支援pathinfo 即可解決:

 

location ~ [^/]\.php(/|$)
        {
try_files $uri =404;
fastcgi_pass  unix:/tmp/php-cgi.sock;
#fastcgi_index index.php;
#include fastcgi.conf;


fastcgi_index index.php;
include fastcgi.conf;
#include pathinfo.conf;
set $fastcgi_script_name2 $fastcgi_script_name;  
if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {  
set $fastcgi_script_name2 $1;  
set $path_info $2;  
}  
fastcgi_param   PATH_INFO $path_info;  
fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name2;  
fastcgi_param   SCRIPT_NAME   $fastcgi_script_name2;
        }     

另外thinkphp支援四種url訪問方式  http://www.jb51.net/article/57928.htm