title: SQLSTATE[HY000] [2002] Connection refused when run multiple laravel project in Docker
body: <ul>
  <li>I have 2 Laravel projects, and my structure folder is (i using win10)</li>
  </ul>
  
  <pre><code>- docker-compose.yml
  - config_projects
    - app1.cnf
    - app2.cnf
  - laravel
    - app1 (domain app1.local)
    - app2 (domain app2.local)
  </code></pre>
  
  <ul>
  <li>Content of docker-compose.yml</li>
  </ul>
  
  <pre><code>version: '3.7'
  services:
  
    web:
      image: nginx
      container_name: webserver_laravel
      restart: unless-stopped
      tty: true
      ports:
        - "8080:80"
      volumes:
        - ./:/var/www/laravel
        - ./config_projects/app1.conf:/etc/nginx/conf.d/app1.conf
        - ./config_projects/app2.conf:/etc/nginx/conf.d/app2.conf
      networks:
        - laravel
  
    php:
      image: php:7.2.5
      container_name: php_laravel
      restart: unless-stopped
      tty: true
      volumes:    
        - ./:/var/www/laravel     
      networks:
        - laravel
  
    db:
      image: mysql:5.7
      container_name: mysql_laravel
      restart: unless-stopped
      tty: true
      command: --default-authentication-plugin=mysql_native_password   
      environment:
        MYSQL_ROOT_PASSWORD: root
      ports:
        - "3306:3306"
      volumes:
        - ./database/mysql:/var/lib/mysql
      networks:
        - laravel
  
  networks:
    laravel:
  </code></pre>
  
  <ul>
  <li>Content of app1.cnf</li>
  </ul>
  
  <pre><code>server {
      listen       80;
      server_name  app1.local;
      root /var/www/laravel/app1/public;
      index index.php index.html;
  
      charset utf8;
      access_log  /var/log/nginx/host.access.log  main;    
  
      location / {
          index  index.php index.html index.htm;
      }
  
      error_page   500 502 503 504  /50x.html;
      location = /50x.html {
          root   /usr/share/nginx/html;
      }    
  
      if (!-e $request_filename) {
          rewrite ^/(.+)$ /index.php?url=$1 last;
          break;
      }
  
      location ~ \.php$ {  
          fastcgi_pass   php:9000;
          fastcgi_index  index.php;
          fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
          include        fastcgi_params;
      }
  }
  </code></pre>
  
  <ul>
  <li>Content of app2.cnf same app1.cnf just replace app1 by app2</li>
  <li>Content .env in app1</li>
  </ul>
  
  <pre><code>DB_CONNECTION=mysql
  DB_HOST=192.168.56.1 ===&gt; My computer's ip
  DB_PORT=3306
  DB_DATABASE=app1 ===&gt; is app2 in app2's env
  DB_USERNAME=root
  DB_PASSWORD=root
  </code></pre>
  
  <ul>
  <li>Run docker-compose up -d --build</li>
  <li>Open app1.local:8080 -> works normally</li>
  <li>Open app2.local:8080 -> SQLSTATE[HY000] [2002] Connection refused</li>
  </ul>
  
  <p><strong>What is the problem ? Thanks so much</strong> </p>