koalaok
koalaok

Reputation: 5760

How to config Vagrant to serve my website on Local network?

I have my vagrant machine serving my sites host/guest env.

I'd like to serve (make available) also these sites across local LAN.

I believe I need to apply port_forwarding or change config from NAT to bridged?

What do you suggest? Sorry but I didn't find until now a comprehensive explanation, on how to make it work.

Upvotes: 0

Views: 929

Answers (2)

Brian Brownton
Brian Brownton

Reputation: 1331

You can also use vagrant share to make your machine publicly accessible over the internet.

Just type vagrant share after the box is running (vagrant up).

You should see something like this:

$ vagrant share
==> default: Detecting network information for machine...
    default: Local machine address: 192.168.163.152
    default: Local HTTP port: 4567
    default: Local HTTPS port: disabled
==> default: Checking authentication and authorization...
==> default: Creating Vagrant Share session...
    default: Share will be at: ghastly-wombat-4051
==> default: Your Vagrant Share is running!
    default: Name: ghastly-wombat-4051
==> default: URL: http://ghastly-wombat-4051.vagrantshare.com

Note you will need an account with hashicorp / atlas account (which is free) and can be acquired right here.

Upvotes: 1

Michal Gasek
Michal Gasek

Reputation: 6423

You can set up your Vagrant box to receive an IP from public network via a bridged interface. This way anyone in the LAN will be able to access your vagrant machine via the assigned public IP.

See vagrant docs: Vagrant - Public network

Upvotes: 0

Related Questions