- Forwarding Port
Now since apache will run inside the guest operating system, so we will have to forward the apache ports to the host operating system.
What this means is that inside the guest operating system apache will be installed.
By default apache will run on port 80 inside the guest OS.
Now in order to check that apache process has been installed successfully and is up and running inside the guest operating system,
We will forward the guest port 80 to the host or your local computer port 8080
We can then simply open the browser on host operating system and connect to localhost on port 8080 and should see the default apache output “it works”.
So for this edit the VagrantFile present in the below location
1
2
c:\testBox
-- Vagrantfile
Add the below yellow highlighted line in the VagrantFile
config.vm.network “forwarded_port”, guest: 80, host: 8080
The above line is used to inform vagrant that once the guest OS is up and running then forward the guest OS port 80 to host on port 8080
So that whatever is running on port 80 inside the guest OS can be accessed by the host on port 8080
This is similar to the port 2222 that we used to ssh into the guest OS, since the guest os default ssh port 22 was forwarded to 2222 for host