Bedrock-ansible Vagrant connection refused

I have been walking through the bedrock-ansible setup and mimicking the directory structure in the example project but am unable to get the site up and running in my browser.

Everything has installed without a problem, I can ping the server:

beerbbq5k.com % ping beerbbq5k.dev
PING beerbbq5k.dev (192.168.50.5): 56 data bytes
64 bytes from 192.168.50.5: icmp_seq=0 ttl=64 time=0.345 ms
64 bytes from 192.168.50.5: icmp_seq=1 ttl=64 time=0.464 ms
64 bytes from 192.168.50.5: icmp_seq=2 ttl=64 time=0.487 ms
64 bytes from 192.168.50.5: icmp_seq=3 ttl=64 time=0.670 ms
^C
--- beerbbq5k.dev ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.345/0.491/0.670/0.116 ms

And ssh into it without a problem, but when visiting the site in the browser I get the ERR_CONNECTION_REFUSED error. Curling the url refuses as well:

curl: (7) Failed to connect to beerbbq5k.dev port 80: Connection refused

What I’d ideally like to know is how to debug this kind of problem. I’m knew to vagrant (and ansible… and bedrock). There is nothing showing up in my nginx logs but short of that I really don’t know where to check. I would definitely think there’s something wrong with my development config in group_vars but have no way to debug anything. Here’s my config for that though

mysql_root_password: devpw

web_user: vagrant

wordpress_sites:
  beerbbq5k.dev:
    site_hosts:
      - beerbbq5k.dev
    local_path: '../site' # path targeting local Bedrock site directory (relative to Ansible root)
    repo: git@github.com:roots/bedrock.git
    site_install: true
    site_title: Beer BBQ 5k
    admin_user: admin
    admin_password: admin
    admin_email: admin@beerbbq5k.dev
    multisite:
      enabled: false
      subdomains: false
    ssl:
      enabled: false
    system_cron: true
    env:
      wp_home: http://beerbbq5k.dev
      wp_siteurl: http://beerbbq5k.dev
      wp_env: development
      db_name: beerbbq5k_dev
      db_user: beerbbq5k_dbuser
      db_password: password

php_error_reporting: 'E_ALL'
php_display_errors: 'On'
php_display_startup_errors: 'On'
php_track_errors: 'On'
php_mysqlnd_collect_memory_statistics: 'On'
php_opcache_enable: 0

xdebug_install: false
php_xdebug_remote_enable: true
php_xdebug_remote_connect_back: true
php_xdebug_remote_host: localhost
php_xdebug_remote_port: 9000
php_xdebug_remote_log: /tmp/xdebug.log
php_xdebug_idekey: XDEBUG
php_max_nesting_level: 200

Thanks for any help!

Saw this issue but it looks like it’s been resolved:
https://discourse.roots.io/t/connection-to-site-on-vagrant-box-refused/?source_topic_id=3976

Is Nginx even running?

$ sudo service nginx status
 * nginx is running

If not try starting it first, and if it doesn’t start, you can run a config check:

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Confirmed that nginx is running

vagrant@beerbbq5k:~$ sudo service nginx status
 * nginx is running
vagrant@beerbbq5k:~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

I’ve got things working now - not sure if anyone will find this helpful but…

I ran vagrant provision and it got me to some errors I could debug - not sure why I didn’t run in to them at first? There was a problem with the yaml parser when executing one of the nginx tasks . I loaded the file in to an online yaml linter and fixed each line and everything worked ok (it was just some indentations and line breaks). I then ran in to a php5-fpm issue but upon rebooting vagrant it was resolved (ie. this didn’t seem related).

Basically yaml wasn’t parsing the tasks and it didn’t throw an error during the build (I guess?). Perhaps someone could shed some light on where I went wrong, but I’m just happy to be up and running.

All set!

1 Like

Good debugging!

That’s really strange though since if there is a YAML error Ansible usually errors out right away before anything and tells you where the error is.

We also automatically run syntax checks on the repo so this doesn’t happen.

No idea but definitely user error, just did another install with a different site and no issues at all - hate/love when that happens!