Some website can't work when accessing guest machine from host if there is port number in URL, (e.g. localhost:8080). I want to access website on guest machine via browser without port number in URL, for example vagrant.localhost.
Is there possibility to access website on guest machine via browser without port in URL?
You have to forward guest port 80 to host port 80 in order to achieve this.
Keep in mind that it will probably work only on Windows hosts, since Linux and Mac OS X both require root privileges to forward to ports < 1024.
Given this, the configuration instructions for doing the above port forwarding is:
config.vm.network "forwarded_port", guest: 80, host: 80
Then after vagrant up
you can access to the website using http://localhost
. If instead you want to use a different name, you have to create an entry in your hosts
file pointing to 127.0.0.1
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments