title: Laravel App HTTP Request to local API on same nginx Docker container
body: <p>docker-compose.yml</p>
  
  <pre><code>web:
    build: ./docker-images/nginx
    ports:
      - "8080:80"
    volumes:
      - ./:/var/www/
      - ./docker-conf/vhost.conf:/etc/nginx/sites-enabled/vhost.conf
    links:
      - php
  
  php:
    image: nmcteam/php56
    volumes:
      - ./docker-conf/php-fpm.conf:/etc/php5/fpm/php-fpm.conf
      - ./:/var/www
  </code></pre>
  
  <p>nginx vhost.conf</p>
  
  <pre><code>server {
      listen 80;
      index index.php index.html;
      server_name myapi.dev;
      error_log  /var/log/nginx/error.log;
      access_log /var/log/nginx/access.log;
      root /var/www/myapi/public;
  
      location / {
          try_files $uri /index.php?$args;
      }
  
      location ~ \.php$ {
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass php:9000;
          fastcgi_index index.php;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_path_info;
      }
  }
  
  server {
      listen 80;
      index index.php index.html;
      server_name mywebapp.dev;
      error_log  /var/log/nginx/error.log;
      access_log /var/log/nginx/access.log;
      root /var/www/mywebapp/public;
  
      location / {
          try_files $uri /index.php?$args;
      }
  
      location ~ \.php$ {
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass php:9000;
          fastcgi_index index.php;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_path_info;
      }
  }
  </code></pre>
  
  <p>windows hosts file</p>
  
  <pre><code>192.168.99.2        mywebapp.dev
  192.168.99.2        myapi.dev
  </code></pre>
  
  <p>docker vm ip</p>
  
  <pre><code>$ docker-machine ip default
  192.168.99.2
  </code></pre>
  
  <p>Okay, so you've seen the above chunks of code and configurations...</p>
  
  <p>I tried to do a GET request using Guzzle from within mywebapp to the location <code>myapi.dev/resource?apikey=myapikey</code>. I have tried with <code>google.com</code> so I know it works, I just don't think I know how things should be requested locally.</p>
  
  <p>Some of the other domains I have tried to no avail:</p>
  
  <pre><code>127.0.0.1/resource?...
  192.168.99.2/resource?...
  0.0.0.0/resource?...
  172.17.0.2/resource?...
  </code></pre>
  
  <p>I know the code works because I've done so with xampp and it worked but not the above docker configuration.</p>