Site can't be reached on browser but vagrant box and nginx are ok

Hello,
I have an issue to reach my WordPress website on my browser although my vagrant box is ready to use and nginx is running.

i got this error :

ERR_CONNECTION_REFUSED

I’m using a Bedrock-based WordPress site and I have a test address http://becode.test/. I just want to work locally from now.

When I installed Trellis, it worked perfectly but now I don’t know why it doesn’t work anymore.
I have recently upgraded Ubuntu from 18.04 to 20.04 but when I tried to re-launch vagrant after my upgrade, it was ok. I’m not sure the issue come from this.

My installation :
Ubuntu 20.04
Ansible 2.9.12
Vagrant 2.2.6

When I run vagrant up :

==> default: Checking if box 'bento/ubuntu-18.04' version '202007.17.0' is up to date...
==> default: A newer version of the box 'bento/ubuntu-18.04' is available and already
==> default: installed, but your Vagrant machine is running against
==> default: version '202007.17.0'. To update to version '202008.16.0',
==> default: destroy and recreate your machine.
==> default: [vagrant-hostmanager:guests] Updating hosts file on active guest virtual machines...
==> default: [vagrant-hostmanager:host] Updating hosts file on your workstation (password may be required)...
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
==> default: Running action triggers after up ...
==> default: Running trigger...
==> default: Adding vagrant ssh-config for becode.test to ~/.ssh/config

==> default: Machine 'default' has a post `vagrant up` message. This is a message
==> default: from the creator of the Vagrantfile, and not from Vagrant itself:
==> default: 
==> default: Your Trellis Vagrant box is ready to use!
==> default: * Composer and WP-CLI commands need to be run on the virtual machine
==> default:   for any post-provision modifications.
==> default: * You can SSH into the machine with `vagrant ssh`.
==> default: * Then navigate to your WordPress sites at `/srv/www`
==> default:   or to your Trellis files at `/home/vagrant/trellis`.

When I go to the vagrant machine and I check the service nginx status :

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-08-25 11:51:27 CEST; 45min ago
     Docs: man:nginx(8)
  Process: 749 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 657 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 754 (nginx)
    Tasks: 3 (limit: 2317)
   CGroup: /system.slice/nginx.service
           ├─754 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           ├─755 nginx: worker process
           └─756 nginx: cache manager process

Aug 25 11:51:26 becode systemd[1]: Starting A high performance web server and a reverse proxy server...
Aug 25 11:51:27 becode systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Aug 25 11:51:27 becode systemd[1]: Started A high performance web server and a reverse proxy server.

In my trellis folder in my file vagrant.default.yml :

vagrant_ip: "192.168.50.44"
vagrant_cpus: 1
vagrant_memory: 2048 # in MB
vagrant_box: "bento/ubuntu-18.04"
vagrant_box_version: ">= 201807.12.0"
vagrant_ansible_version: "2.7.12"
vagrant_skip_galaxy: false
vagrant_mount_type: "nfs"

I checked my hosts on my computer :
cat /etc/hosts :

## vagrant-hostmanager-start id: 84387bd0-acc7-46bf-b1f9-3daa55046378
192.168.50.44   becode.test

the hosts on the vagrant machine :

127.0.0.1       localhost
127.0.1.1       becode.test     becode

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

## vagrant-hostmanager-start
192.168.50.44   becode.test

I tried to connect to the address http://becode.test/ and with the IP adress : 192.168.50.44
But it doesn’t work either.

I tried several times to halt and up vagrant.

I’m not able to fix the issue because vagrant and nginx don’t show problem.

I am a beginner. if anyone has a lead, you are welcome.

Ok, I solved my problem.

The issue was with my Ansible version.

I made a vagrant destroy and vagrant up, but it failed with the Ansible which was too high (2.9.12).
Then I tried to downgrade Ansible but I was not able because link to python 2.7 on my computer and I was unable to use pip installation, cause recently I moved some installation under Python 3.

So, after several try, I took the decision to remove completely Ansible and reinstall it with pip3 --> pip3 install ansible.

It installed the Ansible version 2.8.5 linked to Python 3.8.

Then, I was able to rebuild a vagrant box. I had just a warning about my Ansible version, like that :

[WARNING]: You Ansible version is 2.8.5 but this version of Trellis has only
been tested for compatability with Ansible 2.7.12 -> 2.8.4.

But it was ok, it is not a big issue.

If it can help somebody, I keep my message.
Thanks for reading,

This topic was automatically closed after 42 days. New replies are no longer allowed.