How to connect to vagrant machine using ip address?

Hi,

I am totally new to trellis, vagrant and ansible.

Two questions.

  1. I have vagrant up and I can connect to my machine on my webbrowser.
    but the problem is that I can’t see the webpage wehn I enter the ip address 192.168.50.5.
    I really want to see my webpage with ip address.

  2. How I can reach to vagrant machine from other computer on my local lan network?

Anyone can help?

Thanks a lot!

Hi,

You should be able to to do vagrant ssh and access the vm from the CLI via vagrant

You should see this:

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-87-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

113 packages can be updated.
49 updates are security updates.


*** System restart required ***

Hope this helps you advance,

Justin

1 Like

You’re going to want to setup port forwarding in your Vagrantfile. You need port 80 on your host computer to point to port 80 on the vagrant machine.

Also, you haven’t said if you’ve installed a web service. Have you installed Nginx or Apache on the Vagrant machine and verified it’s serving your site?

This post is tagged trellis, and Trellis does all these steps for you. There’s no need to edit a Vagrantfile if you’re using Trellis.

1 Like

Hi all,

Thanks for your answers.

‘vagrant up’ and getting the main html with host name ‘trellis.test’ on Chrome was successful.
‘vagrant ssh’ also successful.

What I want is that I want to see the webpage with ip address on Chrome.
http://192.168.50.5 from chrome not successfull.
again,
http://trellis.test successful.

Any hint?

Thanks.

Try adding IP in a second canonical entry in site_hosts in group_vars/development/wordpress_sites.yml like second example here

Then ANSIBLE_TAGS=wordpress vagrant provision

2 Likes

Hi,

@eddiesuper, did you find the solution? I have the same problem, I wanted to allow local dev website reachable for other computers in same network (LAN).

@MWDelaney when you said:

Trellis does all these steps for you. There’s no need to edit a Vagrantfile if you’re using Trellis.

Do you mean it expose the local website in the VM to the local network (LAN), or that what suggest @IdeasandPixels (port forwarding)?

We tried all possible IPs (host, VM IP…), and the domain (website.test with private/etc/hosts file configured in other computers) and we’re not able to reach it from other computer in the LAN. The only way we found to reach the VM is with BrowserSync but this do not allow to see correctly the media files list (thumbnails) in the WP admin because of the absolute url that use the domain define for the dev env.

@fullyint Should I try with the IP of my computer (host) or of the VM?

Thank you