title: Vagrant & Nginx - Name Based Virtual Hosts
body: <p>I believe I have set up an nginx virtual host file correctly, however, I'm not able to navigate to that URL on the host machine. I have a slight feeling that I'm misunderstanding something here.</p>
  
  <p>Here's the situation.
  I have a Vagrantfile that does the following:</p>
  
  <ul>
  <li>Installation of Required Packages</li>
  <li>Composer Update</li>
  <li>Copies an Nginx Virtual Host file over to Nginx</li>
  <li>Restarts all relevant services</li>
  </ul>
  
  <p>Heres the vhost file:</p>
  
  <pre><code>server {
      listen 80;
      server_name vagrant;
      root /usr/share/nginx/www;
      index index.html index.htm index.php;
  
      location / {
          try_files $uri /index.php;
      }
  
      location ~ \.php$ {
          fastcgi_pass 127.0.0.1:9000;
          fastcgi_index index.php;
          include fastcgi_params;
      }
  }
  </code></pre>
  
  <p>I can verify that when the virtual host file was called simply <code>vagrant</code> and the server name was set to the following <code>server_name _;</code> that a page was rendered when I visited <code>localhost</code>.</p>
  
  <p>As I'm trying to set up Magento, which doesn't work well with localhost domains, I'm trying to set up a name based virtual host for it under the domain dev.magento.co.uk</p>
  
  <p>If I ssh into the vagrant installation, I can verify that the dev.magento.co.uk file is in the /etc/nginx/site-enabled directory and that it's contents were copied over correctly.</p>
  
  <p>What am I missing?</p>