maj docker
This commit is contained in:
+15
-9
@@ -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
|
||||
# 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
|
||||
+20
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user