Homestead中第一个Laravel项目502 Bad Gateway

来源:互联网 发布:数据库 substring 编辑:程序博客网 时间:2024/05/22 12:58

访问:http://homestead.app/
出错如下:
502 Bad Gateway


nginx/1.11.1

解决:
①最后查看错误日志(/var/log/nginx/.log)
这里写图片描述

②发现这个错误:

2017/11/09 15:37:26 [crit] 970#970: *25 connect() to unix:/var/run/php/php7.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.10.1, server: homestead.app, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.1-fpm.sock:", host: "192.168.10.10"

③分析错误信息,发现是没有php7.1-fpm.sock这个文件

④查看php版本(php -v),当前环境中安装的是PHP7.0

⑤查看fpm的配置文件(/etc/php/7.0/fpm/pool.d/www.conf),发现listen = /run/php/php7.0-fpm.sock

⑥修改nginx配置文件(/etc/nginx/sites-available/)

fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;

改成

fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;

⑦重新加载Nginx和php-fpm

sudo service nginx reload
sudo service php7.0-fpm reload

原创粉丝点击