Last Updated: February 25, 2016
·
1.277K
· bendihossan

Grunt server + Vagrant: Port forwarding & IPs

In your Vagrantfile...

Forward a port from your host machine to 8000 on the guest. 8000 is the default port the grunt server runs on.

config.vm.network "forwarded_port", guest: 8000, host: 8094

Forward port 35729 on your host to the guest. 35729 is the port used by livereload: https://github.com/gruntjs/grunt-contrib-watch#optionslivereload

config.vm.network "forwarded_port", guest: 35729, host: 35729

In your Gruntfile.js use the 0.0.0.0 IP address to allow access from the parent machine & local machine:

connect: {
    options: {
        hostname: '0.0.0.0'
    },
},

https://github.com/gruntjs/grunt-contrib-connect/issues/60