A
A
Andrey Pushkin2019-04-27 13:06:18
Nginx
Andrey Pushkin, 2019-04-27 13:06:18

What should I do if welcomePage nginx opens in docker-compose instead of a website?

I myself sit on manjaro. I raise containers with this
docker-compose.yml config

version: '2'
services:
  nginx:
    build:
      context: ./
      dockerfile: docker/php-fpm.docker
    volumes:
      - ./:/var/www
    ports:
      - "8080:80"
    links:
      - php-fpm
  php-fpm:
    build:
      context: ./
      dockerfile: docker/php-fpm.docker
    volumes:
      - ./:/var/www
    environment:
      - "DB_PORT=3306"
      - "DB_HOST=mysql"
      - "REDIS_PORT=6379"
      - "REDIS_HOST=redis"
    links:
      - mysql
      - redis
  mysql:
    image: mysql
    volumes:
      - ./storage/docker/mysql:/var/lib/mysql
    environment:
      - "MYSQL_ROOT_PASSWORD=123456"
      - "MYSQL_USER=app"
      - "MYSQL_PASSWORD=123456"
      - "MYSQL_DATABASE=app"
    ports:
      - "33061:3306"
  redis:
    image: redis
    ports:
      - "63791:6379"

docker/nginx.docker
FROM nginx:1.10

ADD ./docker/nginx/default.conf /etc/nginx/conf.d/default.conf
WORKDIR /var/www

./docker/nginx/default.conf
server {
    listen 80;
    server_name localost;
    index index.php index.html;
    root /var/www/public;

    location / {
        try_files $uri /index.php?$args;
    }

    location /docs {
        try_files $uri $uri/;
    }

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

All containers start, ps:
5b719abf0af6        laravelloc_nginx     "docker-php-entrypoi…"   4 seconds ago       Up 3 seconds        9000/tcp, 0.0.0.0:8080->80/tcp       laravelloc_nginx_1
e7c1de2377f8        laravelloc_php-fpm   "docker-php-entrypoi…"   5 seconds ago       Up 4 seconds        9000/tcp                             laravelloc_php-fpm_1
b2284c2702ee        mysql                "docker-entrypoint.s…"   6 seconds ago       Up 4 seconds        33060/tcp, 0.0.0.0:33061->3306/tcp   laravelloc_mysql_1
5e2fe0644f5a        redis                "docker-entrypoint.s…"   6 seconds ago       Up 4 seconds        0.0.0.0:63791->6379/tcp              laravelloc_redis_1

But only the welcomepage opens in the browser and doesn't let it go anywhere else, although laravel is installed at the root,
what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Shitskov, 2019-04-27
@a_pussycan

nginx:
    build:
      context: ./
      dockerfile: docker/php-fpm.docker

Compare the name of the container and the dockerfile :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question