【问题标题】:Why my docker cannot process php application?为什么我的 docker 无法处理 php 应用程序?
【发布时间】:2017-12-08 15:18:12
【问题描述】:

我有以下 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:[警告]冲突的服务器名称“”在 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 发送 标准错误:“PHP 消息:PHP 警告: 包括(/usr/share/nginx/html/evodms/lib/LibCakePhp20unit/lib/Cake/Core/CakePlugin.php): 无法打开流:中没有这样的文件或目录 /app/evodms/lib/LibCakePhp20unit/lib/Cake/Core/App.php 在第 505 行

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

nginx_1 | PHP 消息:PHP 致命错误:没有 Class 'CakePlugin' 在第 66 行的 /app/evodms/app/Config/bootstrap.php 中找到“而 从上游读取响应头,客户端:172.26.0.1,服务器:, 请求:“GET /evodms/ HTTP/1.1”,上游: “fastcgi://172.26.0.2:9000”,主机:“本地主机”

nginx_1 | 172.26.0.1 - - [08/Dec/2017:15:15:04 +0000] “获取 /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"

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

【问题讨论】:

  • 你确定文件/usr/share/nginx/html/evodms/lib/LibCakePhp20unit/lib/Cake/Core/CakePlugin.php存在吗?
  • 你还有本地服务器(nginx、apache)以及它使用的端口吗?

标签: docker-compose


【解决方案1】:

我认为您应该尝试使用已经包含 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多