为什么我的docker无法处理php应用程序?

时间:2017-12-08 15:18:12

标签: docker-compose

我有以下docker-compose文件:

version: '2'

services:
  phpfpm:
    tty: true # Enables debugging capabilities when attached to this container.
    image: 'bitnami/php-fpm:5.6'
    labels:
      kompose.service.type: nodeport
    ports:
      - 9000:9000
    volumes:
      - /usr/share/nginx/html:/app
    networks:
      - app-tier

  nginx:
    image: 'bitnami/nginx:latest'
    depends_on:
      - phpfpm
    networks:
      - app-tier
    links:
      - phpfpm
    ports:
      - '80:8080'
      - '443:8443'
    volumes:
      - ./my_vhost.conf:/bitnami/nginx/conf/vhosts/vhost.conf

networks:
  app-tier:
    driver: bridge

以及my_vhost.conf文件的内容:

server {
  listen 0.0.0.0:8080;

  root /app;
  index index.php index.html index.htm;

  location / {
    try_files $uri $uri/ =404;
  }

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

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

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

我的应用程序位于/ usr / share / nginx / html文件夹中。

我尝试过以下链接:

  

nginx_1 | nginx:[warn]冲突的服务器名称""在0.0.0.0:8080,   忽略了

     

nginx_1 | 2017/12/08 15:13:29 [警告] 24#0:冲突   服务器名称""在0.0.0.0:8080,忽略

     

nginx_1 | 2017/12/08 15:15:04 [错误] 25#0:* 1 FastCGI发送   stderr:" PHP消息:PHP警告:   包括(/usr/share/nginx/html/evodms/lib/LibCakePhp20unit/lib/Cake/Core/CakePlugin.php):   无法打开流:没有这样的文件或目录   第505行的/app/evodms/lib/LibCakePhp20unit/lib/Cake/Core/App.php

     

nginx_1 | PHP消息:PHP警告:include():打开失败   ' /usr/share/nginx/html/evodms/lib/LibCakePhp20unit/lib/Cake/Core/CakePlugin.php'   包含(include_path ='。:/ opt / bitnami / php / lib / php')in   第505行的/app/evodms/lib/LibCakePhp20unit/lib/Cake/Core/App.php

     

nginx_1 | PHP消息:PHP致命错误:Class' CakePlugin'不   在第66和34行的/app/evodms/app/Config/bootstrap.php中找到;而   从上游读取响应头,客户端:172.26.0.1,server :,   请求:" GET / evodms / HTTP / 1.1",上游:   " fastcgi://172.26.0.2:9000",主持人:" localhost"

     

nginx_1 | 172.26.0.1 - - [08 / Dec / 2017:15:15:04 +0000]" GET / evodms /   HTTP / 1.1" 500 5" - " " Mozilla / 5.0(X11; Linux x86_64)   AppleWebKit / 537.36(KHTML,与Gecko一样)Chrome / 61.0.3163.100   Safari浏览器/ 537.36"

关于最后一个链接上发生的问题的任何线索?

1 个答案:

答案 0 :(得分:0)

我认为您应该尝试使用已经包含php-fpm和网络服务器的webdevops图像。

version: '3'
services:
  app:
    image: webdevops/php-nginx:7.2
    ports:
      - 9080:80
    volumes:
      - ./:/app
    environment:
      - PHP_DEBUGGER=xdebug
      - PHP_DISPLAY_ERRORS=1
      - WEB_DOCUMENT_ROOT=/app/public