I've been working on getting setup with Vagrant using a VirtualBox base box, and would like to forward ports between my guest (Ubuntu 12.04) and my host (Windows 7) for accessing the apache2 server which will be running on the guest.
The problem I'm running into is that when I try to forward between port
80 on the guest and port
80 on the host (or even
8080) Vagrant will complain and alert me to the fact that the forward port "... is already in use on the host machine."
netstat -a shows that nothing is connected or using port
80 (or even
8080). After some experimentation I found that apparently the free version of Avast! which I am using is blocking the forwarded ports. Not all of Avast! is to blame though, just their Web Shield.
With Avast! Web Shield turned off, using the below configuration file works flawlessly when booting up the VM, with it on... well therein lies the problem.
I want to try and find a solution that allows me to use Vagrant without having to compromise settings on an anti-virus if at all possible, or at the very least have a solution that doesn't have a ton of caveats. The intent is to use Vagrant as a means of simplifying development setup and not over complicating it.
For reference here is my
VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "precise32" config.vm.box_url = "http://files.vagrantup.com/precise32.box" config.vm.network :forwarded_port, guest: 80, host: 80 config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "1024"] end end
I have tried private networks, public networks, etc. but I may be configuring them incorrectly.
Author's Note: This question may have been asked and answered already by someone else, and if it has, I apologize. Everything I've found so far doesn't seem to fit as a solution, I think part of the problem is I'm not sure I know the proper question to ask in order to find the correct solution. If there is an existing solution for this, please, by all means link it!