有nginx和docker映射正确文件夹的问题

时间:2017-09-18 20:18:20

标签: docker docker-compose dockerfile

无论出于何种原因,我都会收到默认的html

我的泊坞窗文件在/Users/xxx/_sites/_blah

Dockerfile
site.conf
docker-compose.yml

我的应用代码在/Users/xxx/_sites/_blah/app

以下是我的文件:

Dockerfile

FROM nginx

# Change Nginx config here...
RUN rm /etc/nginx/conf.d/default.conf
ADD ./site.conf /etc/nginx/conf.d/


COPY content /var/www/html/site

COPY conf /etc/nginx

VOLUME /var/www/html/site

VOLUME /etc/nginx/conf.d/

搬运工-compose.yml

version: '3.3'
services:
  php:
    container_name: pam-php
    image: php:fpm
    volumes:
      - ./app:/var/www/html/site
  nginx:
    container_name: pam-nginx
    image: nginx:latest
    volumes:
      - ./app:/var/www/html/site:rw
      - ./site.conf:/etc/nginx/conf.d/site.conf:rw
    ports:
      - 7777:80

site.conf

    server {
    listen  80;

    server_name localhost;
    root /var/www/html/site;

    error_log /var/log/nginx/localhost.error.log;
    access_log /var/log/nginx/localhost.access.log;

    location / {
        # try to serve file directly, fallback to app.php
        try_files $uri /index.php$is_args$args;
    }

    location ~ ^/.+\.php(/|$) {
        fastcgi_pass 192.168.59.103:9000;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS off;
    }
}

每个教程或代码块都不起作用或者说旧的。

0 个答案:

没有答案