From 0eb73febd7d51b5ee5a79df4b55cda16771097b1 Mon Sep 17 00:00:00 2001 From: Sam DEPARDIEU Date: Wed, 25 Mar 2026 23:01:58 +0100 Subject: [PATCH] maj docker --- docker-compose.yml | 24 +++++++++++++++--------- nginx.conf | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 nginx.conf diff --git a/docker-compose.yml b/docker-compose.yml index af75d14..8cdef1d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,16 +1,22 @@ version: '3' services: + # La partie PHP (ton Dockerfile actuel) app: - build: - context: . - dockerfile: DOCKERFILE - container_name: laravel_app + build: . + container_name: laravel_php restart: always volumes: - .:/var/www - networks: - - app-network -networks: - app-network: - external: true # Pour qu'il puisse parler à ton MySQL et ton Proxy \ No newline at end of file + # La partie Serveur Web (qui parle à NPM et à PHP) + web: + image: nginx:alpine + container_name: laravel_web + restart: always + ports: + - "8000:80" # C'est ce port 8000 qu'il faudra mettre dans NPM ! + volumes: + - .:/var/www + - ./nginx.conf:/etc/nginx/conf.d/default.conf # On va créer ce petit fichier + depends_on: + - app \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..79f8017 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,20 @@ +server { + listen 80; + index index.php index.html; + root /var/www/public; # ICI est le secret du "Not Found" + + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass app:9000; # Il parle au conteneur 'app' + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } + + location / { + try_files $uri $uri/ /index.php?$query_string; + gzip_static on; + } +} \ No newline at end of file