How to configure nginx in docker-compose?


I can not understand why but does not have a website configured via docker-compose

version: '3.1'


image: nginx:latest
- 80:80
- 443:443
- ./hosts/mysite.local.conf:/etc/nginx/conf.d/mysite.local.conf
- ./www:/var/www
- ./www:/usr/share/nginx
- ./logs:/var/log/nginx
- php

settings ./hosts/mysite.local.conf

server {
server_name mysite.local www.mysite.local;
root /var/www/html/public;
listen 80;

location / {
index index.html index.htm index.php;
try_files $uri $uri/ /index.php?$query_string;

location ~ \.php$ {
location 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;

mysite.local opens in hosts all is registered, the service starts, shows the initial page with nginx, there is a suspicion that the problem with the config of nginx or settings docker-compose ?
April 19th 20 at 12:13
2 answers
April 19th 20 at 12:15
To read what is DNS.
So, where does your browser must know the IP address of mysite.local
To register in hosts mysite.local
To check it out.
already registered in the hosts mysite.local - amely.Ha commented on April 19th 20 at 12:18
@amely.Ha, if you open
it says that everything is working actually.
Host machine is Linux?
ping mysite.local - work? - elian.Schmeler commented on April 19th 20 at 12:21
April 19th 20 at 12:17
well, I'm here to play..
if I take your docker-compose , I have no flies, swears on the incorrect bind, change the version from 3.1 to 2 and that all went fine.
further, I of course assume you have a structure all right, but the whole configuration we're not seeing, so -
you have www/ definitely have everything you need? ./www/html/public/ and so on.
In the logs of nginx and ?

add. Pro version - by, it was my bad, on your version, too, everything takes off.
only then the nginx logs to watch - otherwise it is difficult to guess.

Find more questions by tags DockerNginx