Laradock Guzzle Issue or Curl Issue Connection Refused

December 10, 2021

NGINX Configuration Fix

Add network aliases in your docker-compose configuration:

nginx:
    build:
        context: ./nginx
        args:
            - CHANGE_SOURCE=${CHANGE_SOURCE}
            - PHP_UPSTREAM_CONTAINER=${NGINX_PHP_UPSTREAM_CONTAINER}
            - PHP_UPSTREAM_PORT=${NGINX_PHP_UPSTREAM_PORT}
            - http_proxy
            - https_proxy
            - no_proxy
    volumes:
        - ${APP_CODE_PATH_HOST}:${APP_CODE_PATH_CONTAINER}${APP_CODE_CONTAINER_FLAG}
        - ${NGINX_HOST_LOG_PATH}:/var/log/nginx
        - ${NGINX_SITES_PATH}:/etc/nginx/sites-available
        - ${NGINX_SSL_PATH}:/etc/nginx/ssl
    ports:
        - "${NGINX_HOST_HTTP_PORT}:80"
        - "${NGINX_HOST_HTTPS_PORT}:443"
        - "${VARNISH_BACKEND_PORT}:81"
    depends_on:
        - php-fpm
    networks:
        frontend:
            aliases:
                - ssp-api.test
        backend:
            aliases:
                - ssp-api.test

Key Solution

The important part that fixes the connection issues:

networks:
    frontend:
        aliases:
            - ssp-api.test
    backend:
        aliases:
            - ssp-api.test
#Laradock #Docker #Nginx #Networking