Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/268.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Nginx别名给出了';未找到文件';使用Docker组合容器_Php_Laravel_Nginx_Docker Compose_Alias - Fatal编程技术网

Php Nginx别名给出了';未找到文件';使用Docker组合容器

Php Nginx别名给出了';未找到文件';使用Docker组合容器,php,laravel,nginx,docker-compose,alias,Php,Laravel,Nginx,Docker Compose,Alias,我有两个Laravel项目 Laravel 4与664用户:www数据权限 Laravel 5与664用户:www数据权限 注意:modulewo是此虚拟主机中用于指向Laravel 5文件的别名。 我正在尝试在我的本地机器上配置这两个组件,其中Laravel 4是主项目,Laravel 5将用作Nginx虚拟主机中的别名 拉威尔4号运行良好,没有问题 但是,当我尝试访问Laravel 5模块时,它会显示未找到文件。和以下是日志: access.log: GET `/moduletwo/in

我有两个Laravel项目

  • Laravel 4
    与664用户:www数据权限
  • Laravel 5
    与664用户:www数据权限
注意:
modulewo
是此虚拟主机中用于指向Laravel 5文件的别名。 我正在尝试在我的本地机器上配置这两个组件,其中Laravel 4是主项目,Laravel 5将用作Nginx虚拟主机中的别名

拉威尔4号运行良好,没有问题

但是,当我尝试访问Laravel 5模块时,它会显示未找到
文件。
以下是日志:

access.log:

GET `/moduletwo/index.php/LFiveRoute HTTP/1.1" 404 27 "http://www.Laravel.dev/LFourRoute`
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.22.0.1, server: www.Laravel.dev, request: "GET /moduletwo/index.php/LFiveRoute HTTP/1.1", upstream: "fastcgi://172.22.0.5:9000", host: "www.Laravel.dev", referrer: "http://www.Laravel.dev/LFourRoute
/var/www/Laravel4/public/moduletwo/index.php > GET /moduletwo/index.php/LFiveRoute HTTP/1.1
version: '2'
services:
    nginx:
        container_name:
            Laravel-nginx
        restart: always
        build:
            context: ./
            dockerfile: deploy/web.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
            - ./app/storage/logs/nginx:/var/log/nginx
        ports:
            - "80:80"
        links:
            - php71
        networks:
             Laravel_net:
                    ipv4_address: 172.22.0.2
    database:
        container_name:
            Laravel-db
        restart: always
        image: mysql:5.7
        environment:
            - "MYSQL_ROOT_PASSWORD=secret"
            - "MYSQL_ROOT_USER=root"
            - "MYSQL_DATABASE=laravel_4"
        ports:
            - "3309:3306"

        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.3
    redis:
        container_name:
            Laravel-redis
        image: redis:3.2
        ports:
            - "6372:6379"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.4

    php71:
        container_name:
            Laravel-php-71
        restart: always
        build:
            context: ./
            dockerfile: deploy/app.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
        links:
            - database
            - redis
        environment:
            - "DB_PORT=3306"
            - "DB_HOST=database"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.5

networks:
   Laravel_net:
     driver: bridge
     ipam:
       driver: default
       config:
       - subnet: 172.22.0.0/16
         gateway: 172.22.0.1
FROM nginx:1.10

EXPOSE 80
EXPOSE 443

ADD ./deploy/vhost.conf /etc/nginx/conf.d/default.conf
ADD ./deploy/nginx.conf /etc/nginx/nginx.conf
WORKDIR /var/www
FROM php:7.0-fpm

RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client \
    && docker-php-ext-install mcrypt pdo_mysql

WORKDIR /var/www
server {
    listen 80;
    server_name www.laravel.dev;

    charset utf-8;
    sendfile off;
    client_max_body_size 100m;
    index index.php;

    root /var/www/Laravel4/public;

    location ~ ^/moduletwo/(.+(?:css|js|woff|woff2|ttf))$ {
        include fastcgi_params;
        alias /var/www/Laravel5/public/$1;
        #access_log off;
    }   

    #moduletwo code in laravel5
    location /moduletwo/ {
        include fastcgi_params;
        alias /var/www/Laravel5/public;
        ## Check for file existing and if there, stop ##
        if (-f $request_filename) {
            break;
        }

        ## Check for file existing and if there, stop ##
        if (-d $request_filename) {
                break;
        }
        index index.php;
        try_files $uri $uri/ @moduletwo;
#       try_files $uri $uri/ /index.php?$query_string;
    }

    location @moduletwo {
        include fastcgi_params;
        rewrite /moduletwo/(.*)$ /moduletwo/index.php?/$1 last;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php71:9000;
        fastcgi_index index.php;
        set $php_root /var/www/Laravel4/public;
        if ($request_uri ~ /moduletwo) {
            set $php_root /var/www/Laravel5/public;
        }
        fastcgi_param PATH_TRANSLATED $php_root/index.php;

        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param REMOTE_ADDR $http_x_real_ip;
        include fastcgi_params;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_max_temp_file_size 0;
        fastcgi_read_timeout 310;
    }

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

    location ~ /\.ht {
        deny all;
    }
}
错误。日志:

GET `/moduletwo/index.php/LFiveRoute HTTP/1.1" 404 27 "http://www.Laravel.dev/LFourRoute`
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.22.0.1, server: www.Laravel.dev, request: "GET /moduletwo/index.php/LFiveRoute HTTP/1.1", upstream: "fastcgi://172.22.0.5:9000", host: "www.Laravel.dev", referrer: "http://www.Laravel.dev/LFourRoute
/var/www/Laravel4/public/moduletwo/index.php > GET /moduletwo/index.php/LFiveRoute HTTP/1.1
version: '2'
services:
    nginx:
        container_name:
            Laravel-nginx
        restart: always
        build:
            context: ./
            dockerfile: deploy/web.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
            - ./app/storage/logs/nginx:/var/log/nginx
        ports:
            - "80:80"
        links:
            - php71
        networks:
             Laravel_net:
                    ipv4_address: 172.22.0.2
    database:
        container_name:
            Laravel-db
        restart: always
        image: mysql:5.7
        environment:
            - "MYSQL_ROOT_PASSWORD=secret"
            - "MYSQL_ROOT_USER=root"
            - "MYSQL_DATABASE=laravel_4"
        ports:
            - "3309:3306"

        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.3
    redis:
        container_name:
            Laravel-redis
        image: redis:3.2
        ports:
            - "6372:6379"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.4

    php71:
        container_name:
            Laravel-php-71
        restart: always
        build:
            context: ./
            dockerfile: deploy/app.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
        links:
            - database
            - redis
        environment:
            - "DB_PORT=3306"
            - "DB_HOST=database"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.5

networks:
   Laravel_net:
     driver: bridge
     ipam:
       driver: default
       config:
       - subnet: 172.22.0.0/16
         gateway: 172.22.0.1
FROM nginx:1.10

EXPOSE 80
EXPOSE 443

ADD ./deploy/vhost.conf /etc/nginx/conf.d/default.conf
ADD ./deploy/nginx.conf /etc/nginx/nginx.conf
WORKDIR /var/www
FROM php:7.0-fpm

RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client \
    && docker-php-ext-install mcrypt pdo_mysql

WORKDIR /var/www
server {
    listen 80;
    server_name www.laravel.dev;

    charset utf-8;
    sendfile off;
    client_max_body_size 100m;
    index index.php;

    root /var/www/Laravel4/public;

    location ~ ^/moduletwo/(.+(?:css|js|woff|woff2|ttf))$ {
        include fastcgi_params;
        alias /var/www/Laravel5/public/$1;
        #access_log off;
    }   

    #moduletwo code in laravel5
    location /moduletwo/ {
        include fastcgi_params;
        alias /var/www/Laravel5/public;
        ## Check for file existing and if there, stop ##
        if (-f $request_filename) {
            break;
        }

        ## Check for file existing and if there, stop ##
        if (-d $request_filename) {
                break;
        }
        index index.php;
        try_files $uri $uri/ @moduletwo;
#       try_files $uri $uri/ /index.php?$query_string;
    }

    location @moduletwo {
        include fastcgi_params;
        rewrite /moduletwo/(.*)$ /moduletwo/index.php?/$1 last;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php71:9000;
        fastcgi_index index.php;
        set $php_root /var/www/Laravel4/public;
        if ($request_uri ~ /moduletwo) {
            set $php_root /var/www/Laravel5/public;
        }
        fastcgi_param PATH_TRANSLATED $php_root/index.php;

        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param REMOTE_ADDR $http_x_real_ip;
        include fastcgi_params;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_max_temp_file_size 0;
        fastcgi_read_timeout 310;
    }

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

    location ~ /\.ht {
        deny all;
    }
}
script.log:

GET `/moduletwo/index.php/LFiveRoute HTTP/1.1" 404 27 "http://www.Laravel.dev/LFourRoute`
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.22.0.1, server: www.Laravel.dev, request: "GET /moduletwo/index.php/LFiveRoute HTTP/1.1", upstream: "fastcgi://172.22.0.5:9000", host: "www.Laravel.dev", referrer: "http://www.Laravel.dev/LFourRoute
/var/www/Laravel4/public/moduletwo/index.php > GET /moduletwo/index.php/LFiveRoute HTTP/1.1
version: '2'
services:
    nginx:
        container_name:
            Laravel-nginx
        restart: always
        build:
            context: ./
            dockerfile: deploy/web.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
            - ./app/storage/logs/nginx:/var/log/nginx
        ports:
            - "80:80"
        links:
            - php71
        networks:
             Laravel_net:
                    ipv4_address: 172.22.0.2
    database:
        container_name:
            Laravel-db
        restart: always
        image: mysql:5.7
        environment:
            - "MYSQL_ROOT_PASSWORD=secret"
            - "MYSQL_ROOT_USER=root"
            - "MYSQL_DATABASE=laravel_4"
        ports:
            - "3309:3306"

        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.3
    redis:
        container_name:
            Laravel-redis
        image: redis:3.2
        ports:
            - "6372:6379"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.4

    php71:
        container_name:
            Laravel-php-71
        restart: always
        build:
            context: ./
            dockerfile: deploy/app.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
        links:
            - database
            - redis
        environment:
            - "DB_PORT=3306"
            - "DB_HOST=database"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.5

networks:
   Laravel_net:
     driver: bridge
     ipam:
       driver: default
       config:
       - subnet: 172.22.0.0/16
         gateway: 172.22.0.1
FROM nginx:1.10

EXPOSE 80
EXPOSE 443

ADD ./deploy/vhost.conf /etc/nginx/conf.d/default.conf
ADD ./deploy/nginx.conf /etc/nginx/nginx.conf
WORKDIR /var/www
FROM php:7.0-fpm

RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client \
    && docker-php-ext-install mcrypt pdo_mysql

WORKDIR /var/www
server {
    listen 80;
    server_name www.laravel.dev;

    charset utf-8;
    sendfile off;
    client_max_body_size 100m;
    index index.php;

    root /var/www/Laravel4/public;

    location ~ ^/moduletwo/(.+(?:css|js|woff|woff2|ttf))$ {
        include fastcgi_params;
        alias /var/www/Laravel5/public/$1;
        #access_log off;
    }   

    #moduletwo code in laravel5
    location /moduletwo/ {
        include fastcgi_params;
        alias /var/www/Laravel5/public;
        ## Check for file existing and if there, stop ##
        if (-f $request_filename) {
            break;
        }

        ## Check for file existing and if there, stop ##
        if (-d $request_filename) {
                break;
        }
        index index.php;
        try_files $uri $uri/ @moduletwo;
#       try_files $uri $uri/ /index.php?$query_string;
    }

    location @moduletwo {
        include fastcgi_params;
        rewrite /moduletwo/(.*)$ /moduletwo/index.php?/$1 last;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php71:9000;
        fastcgi_index index.php;
        set $php_root /var/www/Laravel4/public;
        if ($request_uri ~ /moduletwo) {
            set $php_root /var/www/Laravel5/public;
        }
        fastcgi_param PATH_TRANSLATED $php_root/index.php;

        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param REMOTE_ADDR $http_x_real_ip;
        include fastcgi_params;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_max_temp_file_size 0;
        fastcgi_read_timeout 310;
    }

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

    location ~ /\.ht {
        deny all;
    }
}
Nginx容器中的进程
Nginx主/辅进程

fpm流程

PHP71容器中的进程
Nginx主/辅进程

fpm流程

Docker编写文件:

GET `/moduletwo/index.php/LFiveRoute HTTP/1.1" 404 27 "http://www.Laravel.dev/LFourRoute`
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.22.0.1, server: www.Laravel.dev, request: "GET /moduletwo/index.php/LFiveRoute HTTP/1.1", upstream: "fastcgi://172.22.0.5:9000", host: "www.Laravel.dev", referrer: "http://www.Laravel.dev/LFourRoute
/var/www/Laravel4/public/moduletwo/index.php > GET /moduletwo/index.php/LFiveRoute HTTP/1.1
version: '2'
services:
    nginx:
        container_name:
            Laravel-nginx
        restart: always
        build:
            context: ./
            dockerfile: deploy/web.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
            - ./app/storage/logs/nginx:/var/log/nginx
        ports:
            - "80:80"
        links:
            - php71
        networks:
             Laravel_net:
                    ipv4_address: 172.22.0.2
    database:
        container_name:
            Laravel-db
        restart: always
        image: mysql:5.7
        environment:
            - "MYSQL_ROOT_PASSWORD=secret"
            - "MYSQL_ROOT_USER=root"
            - "MYSQL_DATABASE=laravel_4"
        ports:
            - "3309:3306"

        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.3
    redis:
        container_name:
            Laravel-redis
        image: redis:3.2
        ports:
            - "6372:6379"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.4

    php71:
        container_name:
            Laravel-php-71
        restart: always
        build:
            context: ./
            dockerfile: deploy/app.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
        links:
            - database
            - redis
        environment:
            - "DB_PORT=3306"
            - "DB_HOST=database"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.5

networks:
   Laravel_net:
     driver: bridge
     ipam:
       driver: default
       config:
       - subnet: 172.22.0.0/16
         gateway: 172.22.0.1
FROM nginx:1.10

EXPOSE 80
EXPOSE 443

ADD ./deploy/vhost.conf /etc/nginx/conf.d/default.conf
ADD ./deploy/nginx.conf /etc/nginx/nginx.conf
WORKDIR /var/www
FROM php:7.0-fpm

RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client \
    && docker-php-ext-install mcrypt pdo_mysql

WORKDIR /var/www
server {
    listen 80;
    server_name www.laravel.dev;

    charset utf-8;
    sendfile off;
    client_max_body_size 100m;
    index index.php;

    root /var/www/Laravel4/public;

    location ~ ^/moduletwo/(.+(?:css|js|woff|woff2|ttf))$ {
        include fastcgi_params;
        alias /var/www/Laravel5/public/$1;
        #access_log off;
    }   

    #moduletwo code in laravel5
    location /moduletwo/ {
        include fastcgi_params;
        alias /var/www/Laravel5/public;
        ## Check for file existing and if there, stop ##
        if (-f $request_filename) {
            break;
        }

        ## Check for file existing and if there, stop ##
        if (-d $request_filename) {
                break;
        }
        index index.php;
        try_files $uri $uri/ @moduletwo;
#       try_files $uri $uri/ /index.php?$query_string;
    }

    location @moduletwo {
        include fastcgi_params;
        rewrite /moduletwo/(.*)$ /moduletwo/index.php?/$1 last;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php71:9000;
        fastcgi_index index.php;
        set $php_root /var/www/Laravel4/public;
        if ($request_uri ~ /moduletwo) {
            set $php_root /var/www/Laravel5/public;
        }
        fastcgi_param PATH_TRANSLATED $php_root/index.php;

        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param REMOTE_ADDR $http_x_real_ip;
        include fastcgi_params;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_max_temp_file_size 0;
        fastcgi_read_timeout 310;
    }

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

    location ~ /\.ht {
        deny all;
    }
}
web.docker文件:

GET `/moduletwo/index.php/LFiveRoute HTTP/1.1" 404 27 "http://www.Laravel.dev/LFourRoute`
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.22.0.1, server: www.Laravel.dev, request: "GET /moduletwo/index.php/LFiveRoute HTTP/1.1", upstream: "fastcgi://172.22.0.5:9000", host: "www.Laravel.dev", referrer: "http://www.Laravel.dev/LFourRoute
/var/www/Laravel4/public/moduletwo/index.php > GET /moduletwo/index.php/LFiveRoute HTTP/1.1
version: '2'
services:
    nginx:
        container_name:
            Laravel-nginx
        restart: always
        build:
            context: ./
            dockerfile: deploy/web.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
            - ./app/storage/logs/nginx:/var/log/nginx
        ports:
            - "80:80"
        links:
            - php71
        networks:
             Laravel_net:
                    ipv4_address: 172.22.0.2
    database:
        container_name:
            Laravel-db
        restart: always
        image: mysql:5.7
        environment:
            - "MYSQL_ROOT_PASSWORD=secret"
            - "MYSQL_ROOT_USER=root"
            - "MYSQL_DATABASE=laravel_4"
        ports:
            - "3309:3306"

        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.3
    redis:
        container_name:
            Laravel-redis
        image: redis:3.2
        ports:
            - "6372:6379"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.4

    php71:
        container_name:
            Laravel-php-71
        restart: always
        build:
            context: ./
            dockerfile: deploy/app.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
        links:
            - database
            - redis
        environment:
            - "DB_PORT=3306"
            - "DB_HOST=database"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.5

networks:
   Laravel_net:
     driver: bridge
     ipam:
       driver: default
       config:
       - subnet: 172.22.0.0/16
         gateway: 172.22.0.1
FROM nginx:1.10

EXPOSE 80
EXPOSE 443

ADD ./deploy/vhost.conf /etc/nginx/conf.d/default.conf
ADD ./deploy/nginx.conf /etc/nginx/nginx.conf
WORKDIR /var/www
FROM php:7.0-fpm

RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client \
    && docker-php-ext-install mcrypt pdo_mysql

WORKDIR /var/www
server {
    listen 80;
    server_name www.laravel.dev;

    charset utf-8;
    sendfile off;
    client_max_body_size 100m;
    index index.php;

    root /var/www/Laravel4/public;

    location ~ ^/moduletwo/(.+(?:css|js|woff|woff2|ttf))$ {
        include fastcgi_params;
        alias /var/www/Laravel5/public/$1;
        #access_log off;
    }   

    #moduletwo code in laravel5
    location /moduletwo/ {
        include fastcgi_params;
        alias /var/www/Laravel5/public;
        ## Check for file existing and if there, stop ##
        if (-f $request_filename) {
            break;
        }

        ## Check for file existing and if there, stop ##
        if (-d $request_filename) {
                break;
        }
        index index.php;
        try_files $uri $uri/ @moduletwo;
#       try_files $uri $uri/ /index.php?$query_string;
    }

    location @moduletwo {
        include fastcgi_params;
        rewrite /moduletwo/(.*)$ /moduletwo/index.php?/$1 last;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php71:9000;
        fastcgi_index index.php;
        set $php_root /var/www/Laravel4/public;
        if ($request_uri ~ /moduletwo) {
            set $php_root /var/www/Laravel5/public;
        }
        fastcgi_param PATH_TRANSLATED $php_root/index.php;

        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param REMOTE_ADDR $http_x_real_ip;
        include fastcgi_params;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_max_temp_file_size 0;
        fastcgi_read_timeout 310;
    }

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

    location ~ /\.ht {
        deny all;
    }
}
app.docker文件:

GET `/moduletwo/index.php/LFiveRoute HTTP/1.1" 404 27 "http://www.Laravel.dev/LFourRoute`
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.22.0.1, server: www.Laravel.dev, request: "GET /moduletwo/index.php/LFiveRoute HTTP/1.1", upstream: "fastcgi://172.22.0.5:9000", host: "www.Laravel.dev", referrer: "http://www.Laravel.dev/LFourRoute
/var/www/Laravel4/public/moduletwo/index.php > GET /moduletwo/index.php/LFiveRoute HTTP/1.1
version: '2'
services:
    nginx:
        container_name:
            Laravel-nginx
        restart: always
        build:
            context: ./
            dockerfile: deploy/web.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
            - ./app/storage/logs/nginx:/var/log/nginx
        ports:
            - "80:80"
        links:
            - php71
        networks:
             Laravel_net:
                    ipv4_address: 172.22.0.2
    database:
        container_name:
            Laravel-db
        restart: always
        image: mysql:5.7
        environment:
            - "MYSQL_ROOT_PASSWORD=secret"
            - "MYSQL_ROOT_USER=root"
            - "MYSQL_DATABASE=laravel_4"
        ports:
            - "3309:3306"

        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.3
    redis:
        container_name:
            Laravel-redis
        image: redis:3.2
        ports:
            - "6372:6379"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.4

    php71:
        container_name:
            Laravel-php-71
        restart: always
        build:
            context: ./
            dockerfile: deploy/app.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
        links:
            - database
            - redis
        environment:
            - "DB_PORT=3306"
            - "DB_HOST=database"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.5

networks:
   Laravel_net:
     driver: bridge
     ipam:
       driver: default
       config:
       - subnet: 172.22.0.0/16
         gateway: 172.22.0.1
FROM nginx:1.10

EXPOSE 80
EXPOSE 443

ADD ./deploy/vhost.conf /etc/nginx/conf.d/default.conf
ADD ./deploy/nginx.conf /etc/nginx/nginx.conf
WORKDIR /var/www
FROM php:7.0-fpm

RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client \
    && docker-php-ext-install mcrypt pdo_mysql

WORKDIR /var/www
server {
    listen 80;
    server_name www.laravel.dev;

    charset utf-8;
    sendfile off;
    client_max_body_size 100m;
    index index.php;

    root /var/www/Laravel4/public;

    location ~ ^/moduletwo/(.+(?:css|js|woff|woff2|ttf))$ {
        include fastcgi_params;
        alias /var/www/Laravel5/public/$1;
        #access_log off;
    }   

    #moduletwo code in laravel5
    location /moduletwo/ {
        include fastcgi_params;
        alias /var/www/Laravel5/public;
        ## Check for file existing and if there, stop ##
        if (-f $request_filename) {
            break;
        }

        ## Check for file existing and if there, stop ##
        if (-d $request_filename) {
                break;
        }
        index index.php;
        try_files $uri $uri/ @moduletwo;
#       try_files $uri $uri/ /index.php?$query_string;
    }

    location @moduletwo {
        include fastcgi_params;
        rewrite /moduletwo/(.*)$ /moduletwo/index.php?/$1 last;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php71:9000;
        fastcgi_index index.php;
        set $php_root /var/www/Laravel4/public;
        if ($request_uri ~ /moduletwo) {
            set $php_root /var/www/Laravel5/public;
        }
        fastcgi_param PATH_TRANSLATED $php_root/index.php;

        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param REMOTE_ADDR $http_x_real_ip;
        include fastcgi_params;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_max_temp_file_size 0;
        fastcgi_read_timeout 310;
    }

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

    location ~ /\.ht {
        deny all;
    }
}
nginx.conf文件

user  www-data;
worker_processes  1;
pid        /var/run/nginx.pid;

error_log  /var/log/nginx/error.log warn;


events {
    # A single worker process can handle 1024 connections
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    log_format scripts '$document_root$fastcgi_script_name > $request';
    access_log /var/log/nginx/scripts.log scripts;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    # Load config files from the /etc/nginx/conf.d directory
    # The default server is in conf.d/default.conf
    include /etc/nginx/conf.d/*.conf;
}
vhost.conf文件:

GET `/moduletwo/index.php/LFiveRoute HTTP/1.1" 404 27 "http://www.Laravel.dev/LFourRoute`
FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.22.0.1, server: www.Laravel.dev, request: "GET /moduletwo/index.php/LFiveRoute HTTP/1.1", upstream: "fastcgi://172.22.0.5:9000", host: "www.Laravel.dev", referrer: "http://www.Laravel.dev/LFourRoute
/var/www/Laravel4/public/moduletwo/index.php > GET /moduletwo/index.php/LFiveRoute HTTP/1.1
version: '2'
services:
    nginx:
        container_name:
            Laravel-nginx
        restart: always
        build:
            context: ./
            dockerfile: deploy/web.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
            - ./app/storage/logs/nginx:/var/log/nginx
        ports:
            - "80:80"
        links:
            - php71
        networks:
             Laravel_net:
                    ipv4_address: 172.22.0.2
    database:
        container_name:
            Laravel-db
        restart: always
        image: mysql:5.7
        environment:
            - "MYSQL_ROOT_PASSWORD=secret"
            - "MYSQL_ROOT_USER=root"
            - "MYSQL_DATABASE=laravel_4"
        ports:
            - "3309:3306"

        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.3
    redis:
        container_name:
            Laravel-redis
        image: redis:3.2
        ports:
            - "6372:6379"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.4

    php71:
        container_name:
            Laravel-php-71
        restart: always
        build:
            context: ./
            dockerfile: deploy/app.docker
        volumes:
            - ./:/var/www/Laravel4
            - ./../Laravel_5:/var/www/Laravel5
        links:
            - database
            - redis
        environment:
            - "DB_PORT=3306"
            - "DB_HOST=database"
        networks:
             Laravel_net:
                 ipv4_address: 172.22.0.5

networks:
   Laravel_net:
     driver: bridge
     ipam:
       driver: default
       config:
       - subnet: 172.22.0.0/16
         gateway: 172.22.0.1
FROM nginx:1.10

EXPOSE 80
EXPOSE 443

ADD ./deploy/vhost.conf /etc/nginx/conf.d/default.conf
ADD ./deploy/nginx.conf /etc/nginx/nginx.conf
WORKDIR /var/www
FROM php:7.0-fpm

RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client \
    && docker-php-ext-install mcrypt pdo_mysql

WORKDIR /var/www
server {
    listen 80;
    server_name www.laravel.dev;

    charset utf-8;
    sendfile off;
    client_max_body_size 100m;
    index index.php;

    root /var/www/Laravel4/public;

    location ~ ^/moduletwo/(.+(?:css|js|woff|woff2|ttf))$ {
        include fastcgi_params;
        alias /var/www/Laravel5/public/$1;
        #access_log off;
    }   

    #moduletwo code in laravel5
    location /moduletwo/ {
        include fastcgi_params;
        alias /var/www/Laravel5/public;
        ## Check for file existing and if there, stop ##
        if (-f $request_filename) {
            break;
        }

        ## Check for file existing and if there, stop ##
        if (-d $request_filename) {
                break;
        }
        index index.php;
        try_files $uri $uri/ @moduletwo;
#       try_files $uri $uri/ /index.php?$query_string;
    }

    location @moduletwo {
        include fastcgi_params;
        rewrite /moduletwo/(.*)$ /moduletwo/index.php?/$1 last;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php71:9000;
        fastcgi_index index.php;
        set $php_root /var/www/Laravel4/public;
        if ($request_uri ~ /moduletwo) {
            set $php_root /var/www/Laravel5/public;
        }
        fastcgi_param PATH_TRANSLATED $php_root/index.php;

        fastcgi_param SCRIPT_FILENAME $request_filename;
        fastcgi_param REMOTE_ADDR $http_x_real_ip;
        include fastcgi_params;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 16k;
        fastcgi_max_temp_file_size 0;
        fastcgi_read_timeout 310;
    }

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

    location ~ /\.ht {
        deny all;
    }
}

有人在吗?请调查一下,帮我解决这个问题。非常感谢。

docker compose exec php71 ls-alh/var/www/Laravel5和
docker compose exec php71 ls-alh/var/www/
的输出是什么?这两个命令的输出都显示了Laravel4和Laravel5目录。所以文件确实存在。将这两个输出添加到docker compose exec php71 ls-alh/var/www/Laravel5的问题输出中。总计340K
drwxrwxr--17 1000 www data 4.0K Sep 21 04:03。
drwxr-xr-x 5 root 4.0K Oct 7 12:02。-rwxrwxr--1 1000 www data 169 Apr 27 17:37。buildpath
-rwxrwxr--1 1000 www-data 1.1K 10月4日10:19.env
drwxrwxr--8 1000 www-data 4.0K 10月6日09:23.git
-rwxr--1 1000 www-data 61 2015年11月23日。gittributes
-rwxrwxr--1 1000 www-data 130 9月15日06:26.gitignore
-rwxrwxrwxr--1 1000 www-data 752 4月27日17:37.project
docker compose exec php71 ls-alh/var/www/Laravel5
docker compose exec php71 ls-alh/var/www/
的输出两个命令的输出都显示了Laravel4和Laravel5目录。所以文件确实存在。将这两个输出添加到docker compose exec php71 ls-alh/var/www/Laravel5的问题输出中。总计340K
drwxrwxr--17 1000 www data 4.0K Sep 21 04:03。
drwxr-xr-x 5 root 4.0K Oct 7 12:02。-rwxrwxr--1 1000 www data 169 Apr 27 17:37。buildpath
-rwxrwxr--1 1000 www-data 1.1K Oct 4 10:19.env
drwxrwxr--8 1000 www-data 4.0K Oct 6 09:23.git
-rwxr--1 1000 www-data 61 Nov 2015.11.23.gittributes
-rwxrwxr--1 1000 www-data 130 Sep 15 06:26.gitignore
-rwxrwxr--1 1000 www-data 752 Apr 27:37.project