Skip to content

Instantly share code, notes, and snippets.

@javidjamae
Last active August 29, 2015 14:24
Show Gist options
  • Save javidjamae/0587e2689fccfa2a2e15 to your computer and use it in GitHub Desktop.
Save javidjamae/0587e2689fccfa2a2e15 to your computer and use it in GitHub Desktop.
Using pow to access Apache on a Vagrant virtual server

This is a much better approach than using Vagrant Hostmanager because you don’t have to worry about polluting your /etc/hosts files on the host or the guest machines. Both the host and the guest machine just treat the guest machine like it’s ‘your-hostname.dev’.

  1. Install pow

    brew install pow
    
  2. Create the port proxy (pow.cx/manual.html#section_2.1.4)

    echo http://127.0.0.1:3333 > ~/.pow/your-hostname
  3. Add the following to your Vagrantfile

    config.vm.network :forwarded_port, guest: 80, host: 3333
    config.vm.hostname = "your-hostname.dev"
    
  4. Create your apache configuration

    <VirtualHost *:80>
      ServerName your-hostname.dev
      DocumentRoot /var/www/your-hostname
    ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment