I can't access the local site on browser - windows 10

Hi, I’ve just done a fresh install of Trellis, Bedrock and Sage.
I’ve also updated everything else: ( I’m on Windows 10 )
Virtual Box - 5.2.18
vagrant - 2.1.5
with the required plugins
vagrant-winnfsd
vagrant-bindfs
vagrant-hostmanager
php - 7.2.5

I do composer install from site directory ( this step is not indicated in the official docs https://roots.io/trellis/docs/local-development-setup/ )
I adjust variables on wordpress_site.yml and vault.yml files.
Then vagrant up in the trellis directory.
And everything seems to work fine.
I can ping to the ip 192.168.50.5 and ssh’ing into de vagrant vm I can run sudo service nginx status and nginx is ok.
But I get an empty page on the browser.
Then I changed dev to test, vagrant destroy and vagrant up again, but there’s still an empty page when I go to mydomain.test
Sorry about the spanish in the below message from the browser :

´# Esta página no funciona

**192.168.50.5**  no ha enviado ningún dato.

ERR_EMPTY_RESPONSE´

The hosts file seems to be updated with the correct DNS
I don’t know if I’ve forgotten something.
Any idea of what I could debug or check would be of great help.
Thank you in advance.

PD - I check other old topics about this issue but I coudn’t find a solution or clue about what to do.

Have you checked your server logs and nginx config?

1 Like

Thank you @alwaysblank for your quick response.
I did cat error.log and cat access.log before posting but these files are empty.
I’m trying to connect to the db.
I don’t know much about nginx but it seems to work fine

● 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 Thu 2018-09-20 07:54:15 UTC; 5h 48min ago
     Docs: man:nginx(8)
  Process: 1401 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exit
  Process: 1172 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; ( Main PID: 1406 (nginx)
    Tasks: 3
   Memory: 13.5M
      CPU: 182ms
   CGroup: /system.slice/nginx.service
           ├─1406 nginx: master process /usr/sbin/nginx -g daemon on; master_process
           ├─1407 nginx: worker process
           └─1408 nginx: cache manager process

Sep 20 07:54:02 myDomain systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 20 07:54:15 myDomain systemd[1]: nginx.service: Failed to read PID from file /run/nginx.pid: Invalid argument
Sep 20 07:54:15 myDomain systemd[1]: Started A high performance web server and a reverse proxy server.

I had never connected to mysql by the command line before and it seems to be working fine too.

vagrant@mydomain:/$ mysql --version
mysql  Ver 15.1 Distrib 10.2.17-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
vagrant@mydomain:/$ mysql -u mydomain_com -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 21
Server version: 10.2.17-MariaDB-10.2.17+maria~xenial mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Any suggestions on what more I could check would be welcome.

What exactly happens when you visit your domain in the browser? Does it give a 500 server error or something similar? I would suggest verifying the domains that have been setup and whether or not SSL is enabled.

1 Like

I’m real sorry.
I was using the ip 192.168.50.0 but I didn’t check the domain itself.
Now I have to figure out why I can’t access the site using the ip address.
I’m reading this post about this issue.

IIRC if you want to access your VM by its IP you need to configure Trellis to explicitly use the IP in the same way you’d configure it to use a domain. Nginx will only serve to things its been told to serve on, and by default it’s not told to serve on the IP address.

1 Like

Ok @alwaysblank, but it’s what vagrant.default.yml does, doesn’t it ?
And by default these are the first three lines in that file.
Well, I modified the memory field.
vagrant_ip: ‘192.168.50.5’
vagrant_cpus: 1
vagrant_memory: 4096 # in MB

Or do I have to indicate that in a custom nginx config file ?

No. Vagrant defines an IP so the VM can be seen on your network by other devices (I. E. The host). It has nothing to do with serving files as a web server.

This is the solution. Add the IP as a domain in your Trellis config.

1 Like

Ok, yes, you’re right and @fullyint gave the solution here.

Thank you for your help