4

Did google and various other search engines but still could not sort it out. Here is my scenario:

Larave 5 on homestead

1) ps -eo pid,comm,euser,supgrp | grep nginx [following is the output ]

2333 nginx root root 2335 nginx vagrant adm,cdrom,sudo,dip,www-data,plugdev,lpadmin,sambashare,vagrant

2) Based on some search result, did make the following on : /etc/php/7.0/fpm/pool.d

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

3) Output with sudo service php7.0-fpm restart

  • Restarting PHP 7.0 FastCGI Process Manager php-fpm7.0 [ OK ]

4) Output with sudo service nginx restart

nginx stop/waiting
nginx start/running, process 2650

5)output with :

sudo /etc/init.d/nginx restart
  • Restarting nginx nginx [fail]

6)output with: tail -f /var/log/nginx/error.log

> 2015/12/26 15:35:23 [notice] 2088#2088: signal process started
2015/12/26 15:45:23 [notice] 2266#2266: signal process started
2015/12/26 15:45:23 [alert] 2095#2095: *9 open socket #3 left in connection 5
2015/12/26 15:45:23 [alert] 2095#2095: aborting
2015/12/26 15:49:02 [alert] 2303#2303: *1 open socket #3 left in connection 3
2015/12/26 15:49:02 [alert] 2303#2303: aborting
2015/12/26 16:00:39 [notice] 2475#2475: signal process started
2015/12/26 16:02:25 [notice] 2525#2525: signal process started
2015/12/26 16:03:08 [notice] 2565#2565: signal process started
2015/12/26 16:14:45 [notice] 2645#2645: signal process started

` I am just having bad time with this 502 Bad Gateway

> nginx/1.9.7

and php

> PHP 7.0.1-1+deb.sury.org~trusty+2 (cli) ( NTS )

` If anyone can please help me move on with this situation, that would be great. And, thank you in advance.

score
  • 521
  • 1
  • 8
  • 22

6 Answers6

9

Finally solved this here. I want to thank Miguel from laracast discussion.

You need to change your configuration file under:

/etc/nginx/sites-enabled

change line fastcgi_pass for

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

php7.0-fpm.sock is located under:

/var/run/php

Since the new VM uses php 7.* and your configuration file might have the php location for 5.6 version.

Then restart Nginx and PHP

sudo service nginx restart

sudo service php7.*-fpm restart

7.3 and the xdebug version in Homestead 8..* are incompatible. Further info found here*

Leo Fisher
  • 310
  • 6
  • 12
score
  • 521
  • 1
  • 8
  • 22
  • Just to verify. You mean the line should be changed too: fastcgi_pass unix:/run/php/php7.0-fpm.sock; ? – Jack Vial Mar 13 '16 at 17:36
  • Thank you, this worked for me. fastcgi_pass unix was pointed at a file that did not exist. – Jack Vial Mar 13 '16 at 18:05
  • 1
    This helped me: https://github.com/laravel/homestead/issues/929#issuecomment-415474971 – Ryan Apr 09 '19 at 00:38
  • For me, the file under `/etc/nginx/sites-enabled` was not writable so I ran `sudo service php7.4-fpm restart` and it created the file `/run/php/php7.4-fpm.sock` – Naveed Sep 09 '21 at 16:14
1

try this in /etc/php/7.0/fpm/pool.d/www.conf

listen.owner = nginx
listen.group = nginx
listen.mode = 0660

finally restart php7.0-fpm

service php7.0-fpm restart
NK74
  • 11
  • 1
1

I've got same error, 502 Bad Gateway (Ngix 1.blablabla)

It's EASY to solve it.

just type into your terminal.

if your VM is running:

vagrant reload --provision

else:

vagrant halt

and later:

vagrant up --provision
Caique Andrade
  • 1,025
  • 7
  • 9
0

I had the same problem ... and solved it in an easy way:

If you use composer, just replace old:

laravel/homestead (v2.*)

with:

laravel/homestead (v3.0.1)
ngm
  • 7,277
  • 1
  • 53
  • 62
  • I had laravel/homestead (v3.0.1) while I had the issue. May be in your case it was an issue with laravel/homestead version. – score Jan 08 '16 at 15:21
0

If you change the sites property after provisioning the Homestead box, you should re-run vagrant reload --provision to update the Nginx configuration on the virtual machine.

0

Here is my story I installed fresh latest homestead and try to run my Laravel 5.4 project but after a day of debugging so gave custom php for my project . This is how it work.

 1. vi Homestead.yaml
 2. sites:
    - map: homestead.test
      to: /home/vagrant/code/my-project/public
      php: "7.1"

php 7.1 works from Laravel 5.4 to 5.7

 3. vagrant up --provision 
Pratik Khadka
  • 908
  • 8
  • 20