Search code examples
phpmagentoubuntunginxfastcgi

nginx: 502 error: connect() failed (111: Connection refused) with vagrant


I'm experiencing 502 gateway errors when accessing my site on 127.0.0.1:8000 Working with Vagrant and ubuntu with nginx, trying to install Magento 2.0. After a lot of bugfixxing I still have this 502 error.

Config:

  • Ubuntu 14.04 (ubuntu/trusty64 box)
  • Php 5.6.18 from ppa
  • Nginx 1.8.1

Error log:

connect() failed (111: Connection refused) while connecting to upstream, client: 10.0.2.2, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:7777", host: "127.0.0.1:8000", referrer: "http://127.0.0.1:8000/"

VagrantFile config: http://pastebin.com/rMSTmwJn

my /etc/php5/pool.d/vagrant.conf (and www.conf) file: http://pastebin.com/hHnFrf55

my /etc/nginx/sites-available/default file: http://pastebin.com/0mwR7CxY

which includes this magento nginx config file: https://github.com/magento/magento2/blob/develop/nginx.conf.sample (no edits)

Also have I edited the user and group in www.conf to 'vagrant'

I'm really stuck on this one. Hope you guys can help! If you need more information, please let me know.


Solution

  • After some more struggling I found out with php5-fpm -t and nginx -t I had an error in my /etc/php5/pool.d/vagrant.conf file rule 1 (:1). I change vagrant to [vagrant].

    Next I got the following error from php5-fpm -t: Both www.conf and vagrant.conf serve on port :7777. Makes sense, so I changed www.conf to listen :9000 and everything is working! Thanks for the effort.