3

Vagrant

I currently have a set up on my development computer that uses apache and the hosts file to point to different folders. I's worked great but I've just discovered vagrant. The only problem with using vagrant is I seem to loose all the ability to use internal domains.

Currently I'm using the hosts file for something like this:

  • main.dev -> localhost -> /local/www/main/

  • *.dev -> localhost -> /local/www/main/

  • staging.dev -> staging server

Is there anyway of mapping those domains to my vagrant box for a particular app instead of having to go to localhost:3000?

2
+100

You can continue to use your hosts file. Let's say you assigned your Vagrant VM the IP address 192.168.11.111. Whereas before your hosts file might have been

127.0.0.1 main.dev staging.dev

Now it would be

192.168.11.111 main.dev staging.dev

However, instead of editing your hosts file manually, there are vagrant plugins that will either edit your hosts file for you or run a local DNS server. Take a look at vagrant-dns and vagrant-hostmaster.

0

Apache reverse proxy on your dev computer. You'll practically map localhost:3000 to localhost/onesite.

or

You can use bridge networking for guest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.