F
F
FOGstudio2016-10-28 21:14:36
Vagrant
FOGstudio, 2016-10-28 21:14:36

How to forward port 80 on host machine in vagrant?

In the settings file, I write "config.vm.network "forwarded_port", guest: 80, host: 80".
There is an error when running vagrant up.
At the same time, if you separately register port forwarding 80 in the nat settings in virtualbox, then everything works correctly.
OS-Windows.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Burlakov, 2017-11-14
@redflasher

Just killed half a day on the same question. In the end, I decided very simply:
You need to open VirtualBox, and then open the "Settings" of the current virtual machine in it:
Press "port forwarding" and then specify 80 -> 80 and others:
That's it!
--
Note: vagrant does not allow ports below 1024, for its own security reasons.
BUT: they can still be passed through the vagrant config file if the launch is from the superuser. How to do this in the console, I did not figure it out. Nor did I manage to get pfctl's firewall (on OS X) to forward ports.
The VirtualBox GUI seems to have enough rights to open any ports.
--
I don’t know for sure, but it seems that VirtualBox does not come with Vagrant. The fact that I have it installed is a legacy from the Docker installation.
However, Vagrant uses the same boxes - VirtualBox images. Apparently, therefore, virtual machines launched through Vagrant are visible in VirtualBox.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question