牛骨文教育服务平台(让学习变的简单)
博文笔记

nginx 下 thinkphp 502 bad Gateway + "LNMP一键安装包的Nginx 502 Bad Gateway错误可能原因及解决方法"

创建时间:2016-10-18 投稿人: 浏览次数:2332

参考: 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


声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。