#Connection refuse when access to localhost
17 messages · Page 1 of 1 (latest)
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 . 😦
Where are you getting 8000 from?
is from nginx container 😄
That's 8080 not 8000
oh sorry. The fonts kinda hard to see.
But i tried both https://127.0.0.1:8000 and https://127.0.0.1:8080
both give me refused connect 😦
i feel i missing something but i can't figure out
just use laravel sail instead of a custom docker setup
assuming this is for local development
Sail is the first party maintained local docker dev environment https://laravel.com/docs/9.x/sail
oh men