Rather than hacking on a hosts file (which can break networking) I would 
setup aliases in your development environment that let you "launch site1" 
and it will open whichever site is aliased as 'alias site1='firefox 
vagrantip:port1' or something like that. The other alternative would be to 
use bridging instead of port forwarding, and then you can directly access 
any and all ports on your Vagrant machine via a dedicated IP on your 
system's subnet.

On Thursday, June 25, 2015 at 11:31:51 AM UTC-5, Jake Wilson wrote:
>
> I'm new to using Vagrant and got a question about forwarded ports. In my 
> vagrant instance, I have a number of different websites that I am 
> developing. Not just a single site. I would prefer to access these sites in 
> the browser using host definitions instead of http://localhost:8080.
>
> So for example, in my Vagrantfile I set my guest machine to have a 
> particular ip, i just randomly chose 192.168.0.150. Next on my host 
> machine, I edited my hosts file (I'm using Windows 7) to point my 
> development domain names to my guest machine:
>
> 192.168.0.150   website1.local website2.local website3.local
>
> So now, do I HAVE to use the port forwarding? I would prefer to access my 
> local dev websites in the browser using just "http://website1.local"; 
> instead of "http://website1.local:8080";. 
>
> How do I achieve this? Do I forward a port from 80 to 80? Or do I disable 
> port forwarding all together? Is this a common approach to developing on 
> multiple sites in a single vagrant environment?
>
>
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/8b699282-2de0-48a8-be99-f2d7d3cd7583%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to