ERR_CONNECTION_REFUSED on multiple Vagrant boxes

I have multiple VM’s using VirtualBox and all of a sudden I am getting the following error when trying to access multiple sites.

This site can’t be reached
particlestest.local refused to connect.

This is happening across multiple boxes. This particular site is a brand new fresh Trellis install and it happened straight away.

I have Vagrant Destroyed and Vagrant Up’d multiple boxes which managed to bring one site back but not any of the others.

Each VM has a dedicated IP address in vagrant.default.yml.

I have tidied up and then cleaned out /etc/hosts to ensure there is no conflicting addresses.

I have made sure that no other boxes are running when doing a Vagrant Up

I’m still getting the same error though. Any help would be gratefully appreciated as I’m pulling out what little hair I have left!

Firstly you’d need to rule out that your .local TLD isn’t causing issues. This causes many issues on Mac OS for example. There’s many posts in this discourse about that TLD.

Since you mentioned this happens on all your machines new and old, my initial port of call would be to check out the health of the servers after a vagrant up. Some steps would be:

  • SSH into the vagrant
  • Is nginx working as expected? nginx -t
  • Check appropriate directories i.e.srv/www/particlestest.local/current - does it exist?
  • Check nginx logs in /var/log/nginx/log/error.log - Any indications of issues with nginx?
  • Test WP CLI connectivity in srv/www/particlestest.local/current & wp config list - are your credentials correct?
  • Does your database hold the correct sites? In srv/www/particlestest.local/current & wp site list --field=url
  • Check site specific error logs in srv/www/particlestest.local/logs/error.log - are there any fatal errors or other things to look at?
  • Create a phpinfo.php file in the /srv/www/particlestest.local/current/webdirectory. With the contents <?php phpinfo(); ?> then try to access this in your browser at particlestest.local/phpinfo.php

If all is above board there I’d move onto VM debugging. It could be that you are creating a VM on an existing faulty VM. To eliminate that possibility you could take a look in the VirtualBox GUI and backup / remove any to ensure you really are starting fresh.

Finally to diagnose IP / routing issues you could:

  • Confirm your /etc/hosts file
  • Confirm that the IP specified in your vagrant config is of local IP scope
  • Perform a traceroute on your particlestest.local (google is your friend here)
  • Test for IP / Service conflicts using lsof or equivalent

That’s really helpful, thank you :slightly_smiling_face:

I ended up Vagrant Destroying the VM and rebuilding it and this time it brought it back, for this one VM. I’m not convinced that this issue has completely gone away however, I think its still bubbling under the surface.

Other than what I had already done, I wasnt sure where to go next with it so this is a great help.