title: docker nginx and php, php cant connect to localhost
body: <p>I have created an nginx container that is open to port 8080:80
  so I could access it from the host.</p>
  
  <p>it is connected to php fpm container that has an open port 9000:9000</p>
  
  <p>nginx successfully runs with php.</p>
  
  <p>My problem is that php tries to access localhost:8080
  but the problem is that the php localhost:8080 is not valid, it needs to connect to the nginx container.</p>
  
  <p>here is the error on my wordpress site:
  you can see that something is funky there...
  below I'll attach my docker-compose.yml</p>
  
  <hr>
  
  <p>Downloading install package from <a href="http://localhost:8080/wp-content/themes/realtyspace/plugins/advanced-custom-fields-pro.zip" rel="nofollow noreferrer">http://localhost:8080/wp-content/themes/realtyspace/plugins/advanced-custom-fields-pro.zip</a>…</p>
  
  <p>Download failed. cURL error 7: Failed to connect to localhost port 8080: Connection refused</p>
  
  <hr>
  
  <p>docker-compose.yml</p>
  
  <pre><code>version: '2'
  services:
    my-nginx:
      build: .
      volumes:
        - ./../:/var/www/html
      ports:
        - "8080:80"
      links:
        - my-php
  
    my-php:
      build:
        context: .
        dockerfile: Dockerfile.php-fpm
        volumes:
          - ./../:/var/www/html
        ports:
          - "9000:9000"
        links:
          - my-mysql
  
    my-mysql:
      image: mariadb:5.5
      volumes:
        - /var/lib/mysql
      environment:
        MYSQL_ROOT_PASSWORD: wp
        MYSQL_DATABASE: wp
        MYSQL_USER: wp
        MYSQL_PASSWORD: wp
  </code></pre>