Local development issues —can't get example page up on browser

Hi!

I’m following the Roots Example Project steps (https://github.com/roots/roots-example-project.com) on Github. My current goal is just getting a local development environment setup. Everything works fine—no errors when I run “vagrant up”—but when I visit roots-example-project.dev in my browser (Chrome, Safari, and Firefox), I get a “this site can’t be reached” error.

I’m running this on Mac OS X Yosemite.
Version for everything else is the newest available because I just downloaded them.

I’ve already followed the Unresponsive machines/404 error troubleshooting guide (https://roots.io/trellis/docs/troubleshooting/). This is what my host file looks like:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
98.172.xx.xxx admin.azsba.org
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost 

## vagrant-hostmanager-start id: 376c3ff3-3840-4e1b-b423-01e08f9bc173
192.168.50.5	roots-example-project.dev
192.168.50.5	www.roots-example-project.dev
## vagrant-hostmanager-end

When I ping roots-example-project.dev, I get this:

PING roots-example-project.dev (192.168.50.5): 56 data bytes
64 bytes from 192.168.50.5: icmp_seq=0 ttl=64 time=1.424 ms
64 bytes from 192.168.50.5: icmp_seq=1 ttl=64 time=0.601 ms
64 bytes from 192.168.50.5: icmp_seq=2 ttl=64 time=0.548 ms
64 bytes from 192.168.50.5: icmp_seq=3 ttl=64 time=0.469 ms
64 bytes from 192.168.50.5: icmp_seq=4 ttl=64 time=0.468 ms
64 bytes from 192.168.50.5: icmp_seq=5 ttl=64 time=0.783 ms
64 bytes from 192.168.50.5: icmp_seq=6 ttl=64 time=0.376 ms
64 bytes from 192.168.50.5: icmp_seq=7 ttl=64 time=0.503 ms
^C
--- roots-example-project.dev ping statistics ---
8 packets transmitted, 8 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.376/0.647/1.424/0.315 ms

This should mean the website is running, right? I am able to run “vagrant ssh” and access the web files as well—I just can’t seem to access the website on my browser.

I’m not sure how to further troubleshoot. I would appreciate any guidance you can provide! Feel free to ask if you would like more information regarding my setup, etc.

3 Likes

Thanks for the debugging info and steps you took :clap:

What you’ve done means the server is running and DNS/hosts file is working at least.

Here’s the next steps you can take:

  1. vagrant ssh
  2. sudo service nginx status

Hopefully that says it’s not running since that’s easier to debug.

If it’s not running, you can run sudo nginx -t to see if there’s any configuration issues. And might as well try to run sudo service nginx start or sudo service nginx restart and see if that gets it running.

3 Likes

Thank you for the quick response!

I ran sudo service nginx status and it IS running…

vagrant@roots-example-project:~$ sudo 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 Wed 2017-01-11 22:01:49 UTC; 12min ago
 Docs: man:nginx(8)
  Process: 1385 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/S
  Process: 1250 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, s
 Main PID: 1389 (nginx)
Tasks: 3
   Memory: 7.8M
  CPU: 35ms
   CGroup: /system.slice/nginx.service
       ├─1389 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
       ├─1390 nginx: worker process                           
       └─1391 nginx: cache manager process                    

Jan 11 22:01:46 roots-example-project systemd[1]: Starting A high performance web server and a reve
Jan 11 22:01:49 roots-example-project systemd[1]: nginx.service: Failed to read PID from file /run/
Jan 11 22:01:49 roots-example-project systemd[1]: Started A high performance web server and a rever

Also ran sudo service nginx restart for good measure, but nothing happened :frowning: Any other ideas?

Meanwhile, I followed another tutorial (http://davekiss.com/develop-wordpress-sites-like-a-goddamn-champion/) and that site worked…no idea what changed. Could it be an issue with installing Sage?

I guess it could have been an error. You can check the Nginx error logs if it’s on the same VM.

They should be located in /srv/www/roots-example-project.com/logs

Hi @swalkinshaw, and what to do if Nginx wasn’t installed while vagrant up?

Because I got No such file or directory when I checked for service status…

Thank you

Ok I found it, it was because of Ansible version wasn’t updated (1.9.4), after I updated to the 2.5.2 it worked ok after installed Nginx. If it can help someone else.

What worked for me was after I initially ran vagrant up was ssh’ing into the virtual machine vagrant ssh and restarting nginx sudo service nginx restart.

I am also using Ansible 2.5.2 and saw a warning about compatibility.

I’m guessing nginx started before configuration was complete? Not sure, but would be nice to fix that so others don’t run into it on their first use of Trellis locally.

Could this be because of .dev instead of .test?

https://roots.io/guides/updating-development-tld-from-dev-to-test/

1 Like

@nperrier you might be running into this if you created this Trellis install recently: https://github.com/roots/trellis/issues/979

If so, apply this change to your Trellis installation:

…and make sure to re-provision :slight_smile:

1 Like

This is the current commit of Trellis I cloned from:

6ac097c <Nathaniel> - (HEAD -> master, origin/master, origin/HEAD) Merge pull request #985 from roots/xdebug-autostart (5 days ago)

And I see the fix you mentioned:

ee8c437 <Nathaniel> - Enable nginx to start on boot (#980) (7 days ago)

So Nginx was running when I logged into the box, but the site was failing to load on my host. I just logged into my laptop today and it seems that the site isn’t loading again:

ping: sendto: Host is down

I’m not sure what’s going on here because it was running fine yesterday?

I checked the nginx logs for my site and saw this:

018/05/03 21:49:31 [crit] 9132#9132: *158 stat() "/srv/www/h4h.com/current/web/app/themes/h4h-theme/dist/scripts/main.js" failed (5: Input/output error), client: 192.168.50.1, server: h4h.test, request: "GET /app/themes/h4h-theme/dist/scripts/main.js HTTP/1.1", host: "h4h.test", referrer: "http://localhost:3000/"

I’m using browsersync to develop on my host machine, but attempting to load the site directly via http://h4h.test doesn’t work either.

Oh, I think this might be the problem:

vagrant@h4h:~$ ls trellis
ls: cannot access 'trellis': Input/output error

Did my shared folder disappear? It appears so.

I should mention I’m on MacOS High Sierra and I’m reading there might be an issue related to my setup:

I am using a symlink on my host machine where my site is located:

★  homesforheroes.com $ ls -l
lrwxr-xr-x   1 nathan.perrier  staff   44 May  3 14:51 h4h -> /Users/nathan.perrier/git_repos/h4h
drwxr-xr-x  30 nathan.perrier  staff  960 May  3 15:39 trellis

I’m going to try removing the symlink and restarting the box.

Removing the symlink and restarting the box seemed to work.

We’ll see if the shared folder stays connected. I suspect it might be because of the symlink but I’m not certain.

Hi all. I’m new to using Roots and I have experienced this local development provisioning issue. After cloning the roots-example-project.com, I am able to see the Wordpress install after running vagrant up within the trellis directory. However, when I go to edit the .yml files within the development directory, to customize the url’s for the project, the site won’t show/load after a vagrant reload --provision. I have deleted the Virtual Box that was installed which then allowed me to see the site, but if I pause or stop the Box, the site won’t load again. Please forgive the verbose explanation and thank you.

@michaelprflores I believe this quote from above could apply:

The roots example project doesn’t yet include the related fix, but Trellis itself does include the fix.

Rather than cloning the example project directly, try following the manual steps to clone Sage, Bedrock, and Trellis separately.

Thanks @fullyint. I’ll walk through the steps in the post your provided. I did also try this: Nginx restart and it didn’t work for me.