i trying make local dev environment can work on site matthewfedak.co.uk.
i using vagrant , virtual box.
here vagrant file:
vagrant.configure("2") |config| config.vm.box = "lucid32" config.vm.provision :shell, :path => "localhost.sh" config.vm.network :forwarded_port, host:4567, guest: 80 config.vm.network :forwarded_port, host: 3306, guest: 3306 config.vm.synced_folder "/users/mfedak/sites", "/var/www/vhosts", :owner => "www-data", :group => "www-data" end
here /etc/hosts file:
## # host database # # localhost used configure loopback interface # when system booting. not change entry. ## #127.0.0.1 localhost #255.255.255.255 broadcasthost #::1 localhost #fe80::1%lo0 localhost 127.0.0.1:4567 matthewfedak.co.uk 127.0.0.1:4567 www.matthewfedak.co.uk
here vhost site in /etc/apache2/sites-enabled/matthewfedak.co.uk
vagrant@lucid32:~$ sudo vim /etc/apache2/sites-enabled/matthewfedak.co.uk
<virtualhost *:80> serveradmin info@matthewfedak.co.uk servername matthewfedak.co.uk serveralias www.matthewfedak.co.uk documentroot /var/www/vhosts/matthewfedak.co.uk/httpdocs/ errorlog /var/www/vhosts/matthewfedak.co.uk/logs/error.log customlog /var/www/vhosts/matthewfedak.co.uk/logs/access.log combined </virtualhost>
it sounds simple getting bored of toying now. have setup lots of ubuntu servers before don't think that, getting host / remote communicate.
by default vagrant uses nat mode networking, requires lot of port mappings if testing full stack. what's more, due limitation of virtualbox's nat mode:
forwarding host ports < 1024 impossible:
on unix-based hosts (e.g. linux, solaris, mac os x) not possible bind ports below 1024 applications not run root. result, if try configure such port forwarding, vm refuse start.
that's why use port 4567 on host, right?
now, root cause in /etc/hosts
127.0.0.1:4567 matthewfedak.co.uk 127.0.0.1:4567 www.matthewfedak.co.uk
the hosts
file simple text file associates ip addresses hostnames, 1 line per ip address. not work port numbers.
to work around, consider using bridged mode or vagrant's private network can access guest using ip address instead of using host's loopback.
Comments
Post a Comment