- 1 year ago
How to access website served by vagrant (ubuntu) VM through a second (Windows) VM?
Comment
1 / 1
To access a website served by a Vagrant Ubuntu VM from a second Windows VM, you need to configure networking between the two VMs. Here are the general steps to achieve this:
Set up the Vagrant Ubuntu VM:
- Ensure that the Vagrantfile for the Ubuntu VM has networking configured correctly. It should include a private network configuration, such as:ruby
Vagrant.configure("2") do |config|
config.vm.network "private_network", ip: "192.168.33.10"
end
- Run
vagrant up
to start the Ubuntu VM.
- Ensure that the Vagrantfile for the Ubuntu VM has networking configured correctly. It should include a private network configuration, such as:
Configure the Windows VM:
- Ensure that the Windows VM is connected to the same network as the Ubuntu VM. This can be achieved by configuring the VM's network adapter to use the "Bridged" or "Host-Only" network mode.
- Assign a static IP address to the Windows VM on the same network. For example, set the IP address to
192.168.33.20
.
Access the website:
- In the Windows VM, open a web browser and enter the IP address of the Ubuntu VM in the address bar. In this case, it would be
http://192.168.33.10
. - If the website is configured to listen on the default HTTP port (80), you should be able to access it.
- In the Windows VM, open a web browser and enter the IP address of the Ubuntu VM in the address bar. In this case, it would be
Make sure to adjust the IP addresses and network configurations to match your specific setup.
By configuring the network settings correctly, you should be able to access the website served by the Vagrant Ubuntu VM from the second Windows VM.