good morning, I am a novice user in Docker. I was going to launch Docker for a Laraveli project, and when I run this project with the help of docker-compose nginx runs on port 8000, but inside the browser when it opens Reply
file docker-compose.yml
version: "3.8"
services:
server:
image: 'nginx:stable-alpine'
ports:
- '80:80'
volumes:
- ./src:/var/www/html
- ./Docker/nginx/:/etc/nginx/conf.d/
php:
build:
context: .
dockerfile: Docker/php/php.Dockerfile
volumes:
- ./src:/var/www/html:delegated
mysql:
image: mysql:5.7
env_file:
- Docker/mysql/mysql.env
file nginx.conf
server {
listen 80;
index index.php index.html;
server_name localhost;
root /var/www/html/public;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
Folder structure:
ِDocker
php
nginx
mysql
src
docker-compose.yml
2
Answers
Can you show docker file ?
Example for docker-compose.yml
}
try this nginx conf