一般情况网页报502 很大可能是配置文件出错了,最大可能是fastcgi_pass unix:这个参数错误。
所以直接去找php fpm下面的www.conf里面的listen
/etc/php/5.6/fpm/pool.d/www.conf
或者是/etc/php/7.0/fpm/pool.d/www.conf 具体在哪里看你怎么装
如果Listen是端口就写127.0.0.1:9000;
如果Listen是路径,nginx的配置文件也要写路径,unix:/run/php/php5.6-fpm.sock;或者/run/php/php7.0-fpm.sock; 反正里面是什么就填什么。
netstat -ant | grep 9000
如果出现404 找不到页面的问题是因为服务器不支持重写。不支持tp框架的pathinfo这套东西。
# --start--- TP5加上这一块 支持pathinfo
location /{
index index.html index.htm index.php;
if (-e $request_filename) {
break;
}
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
# --end--- TP5加上这一块 支持pathinfo
原文:https://www.cnblogs.com/lvtiansong/p/11248732.html