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


Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐