1

I got inside the browser:

404 Not Found
nginx/1.13.10

and in the logs I got:

$ ls logs/
nginx-access.log    nginx-error.log
$ cat logs/*
172.17.0.1 - - [27/Mar/2018:02:11:35 +0000] "GET / HTTP/1.1" 404 572 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36" "-"
2018/03/27 02:11:35 [error] 5#5: *1 "/var/wwww/html/index.php" is not found (2: No such file or directory), client: 172.17.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost"

My nginx/nginx.conf looks like this:

server {
    listen  80;

    # this path MUST be exactly as docker-compose.fpm.volumes,
    # even if it doesn't exists in this dock.
    root /var/wwww/html;
    index index.php index.html index.html;

    server_name localhost;

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass phpfpm:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

My docker-compose.yml looks like:

nginx:
    image: nginx
    restart: always
    ports:
        - "80:80"
    links:
        - phpfpm
        - db
    volumes:
        - ./logs/nginx-error.log:/var/log/nginx/error.log
        - ./logs/nginx-access.log:/var/log/nginx/access.log
        - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
        - ./public/:/var/www/html

phpfpm:
    build: ./mGSV
    restart: always
    ports:
        - "9000:9000"
    links:
        - db
    volumes:
        - ./public/:/var/www/html

db:
    image: mariadb
    restart: always
    environment:
          - MYSQL_ROOT_PASSWORD=admin
          - MYSQL_DATABASE=mgsv
          - MYSQL_USER=mgsv_user
          - MYSQL_PASSWORD=mgsvpass
    ports:
          - "3306:3306"
    volumes:
          - ./mysql/:/docker-entrypoint-initdb.d 

phpmyadmin:
  image: phpmyadmin/phpmyadmin
  restart: always
  links:
    - db
  ports:
    - 8183:80
  environment:
    PMA_USER: root
    PMA_PASSWORD: admin
    PMA_ARBITRARY: 1

My ./mGSV/Dockerfile is based on:

FROM php:5-fpm

What did I miss?

Thank you in advance.

user977828
  • 205
  • 4
  • 15

1 Answers1

1

I am not familiar with docker but I see 2 inconsistencies here:

Independent of the docker part, nginx (nginx/nginx.conf) tries to serve content from /var/wwww/html. This is probably a typo (did you mean /var/www/html?). Thus the exact error message "/var/wwww/html/index.php" is not found (2: No such file or directory) - there has to be content in this folder for this nginx config to work.

Also your nginx comment says # this path MUST be exactly as docker-compose.fpm.volumes, but the phpfpm volumes part in your docker-compose.yml says ./public/:/var/www/html.

What are you actually trying to achieve?

mlist
  • 31
  • 3