#Connection refuse when access to localhost

17 messages · Page 1 of 1 (latest)

steep mauve
#

Hello guys. Im setup my web development for side projects with Laravel + Docker. I getting confused error when access to localhost:8000

#

My docker-compose.yml

#
version: '3'

# Network : Laravel
networks: 
  laravel:
    driver: bridge
services:
  # ===================== Nginx =========================== #
  nginx:
    image: nginx:latest
    restart: "always"
    container_name: nginx
    ports: 
      - 8080:80
    # Mounts
    volumes:
      # - File config "." mean same level of file
      - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
      # - Mount location for contains all projects 
      - /home/hoangtho/Projects/:/usr/share/nginx/html/
    depends_on:
      - php
      - mysql
    #   - mysql - Need install mysql
    networks:
      - laravel
  # ===================== PHP =========================== #  
  php:
    image: php-7.4-fpm
    container_name: php
    ports:
      - 9000:9000
    build:
      context: './php/'
    # Volumes store my php file
    volumes:
      - /home/hoangtho/Projects/:/usr/share/nginx/html/
    working_dir: /usr/share/nginx/html/
    tty: true
    networks: 
      - laravel
  # ======================== Mysql ======================= #
  mysql:
    image: mysql:latest
    container_name: mysql
    ports: 
      - 3306:3306
   
    environment:
    # default database
       MYSQL_DATABASE: default
       MYSQL_ROOT_PASSWORD: root
       MYSQL_USER: hoangtho
       MYSQL_PASSWORD: tho230697
    networks:
      - laravel
    # ========================= End of config ========================= #

#

My project .env


APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:MbV5mxzv7u4P4b8nb+xk9848joWqZ3ULUw75ZIseaUo=
APP_DEBUG=true
APP_URL=http://localhost:8080

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=default
DB_USERNAME=hoangtho
DB_PASSWORD=tho230697
#

I run php artisan serve in docker terminal . 😦

tardy crescent
#

Where are you getting 8000 from?

steep mauve
tardy crescent
#

That's 8080 not 8000

steep mauve
#

both give me refused connect 😦

#

i feel i missing something but i can't figure out

cunning thorn
#

just use laravel sail instead of a custom docker setup

#

assuming this is for local development

steep mauve
#

is laravel sail work with docker too?

#

i want to use it in Docker

cunning thorn
steep mauve
#

oh men