首页 > 解决方案 > 1#1: pread() "/etc/nginx/conf.d/default.conf" 失败(38: 功能未实现)

问题描述

在编码时,我的“Docker Container”崩溃了好几次了。查看日志,这是它向我展示的内容:

[crit] 1#1: pread() "/etc/nginx/conf.d/default.conf" failed (38: Function not implemented)

这是 Docker-compose 配置,以及 nginx 的 default.conf :

码头工人-compose.yml:

version:  '3.7'
services:
    mariadb:
        image: ${MARIADB_VERSION}
        restart: on-failure
        environment:
            MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
            MYSQL_DATABASE: ${MYSQL_DATABASE}
            MYSQL_USER: ${MYSQL_USER}
            MYSQL_PASSWORD: ${MYSQL_PASSWORD}
        ports:
            - ${PORTS_MARIADB}
        volumes:
            - sql-data:/var/lib/mysql
        #user: 1000:1000
    php:
        build:
            context: .
            dockerfile: docker/php/Dockerfile
        volumes:
            - './app/:/usr/src/app'
        restart: on-failure
        user: 1000:1000
        environment:
            APP_ENV: dev
            APP_DEBUG: 1
            SECRET: ddezde2z3dea12da21azd23adz1
            DB_USER: ff
            DB_PWD: fezfezfezfezfze
            DB_NAME: ff
            DB_VER: mariadb-10.4.12
            DB_PORT: 3306
    nginx:
        image: ${NGINX_VERSION}
        restart: on-failure
        volumes:
            - './app/public/:/usr/src/app' 
            - './docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro'
        ports:
            - ${PORTS_NGINX}
        depends_on:
            - php
volumes:
  sql-data:

default.conf (nginx):

    server {
    server_name ~.*;

    location / {
        root /usr/src/app;

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

    # optionally disable falling back to PHP script for the asset directories;
    # nginx will return a 404 error when files are not found instead of passing the
    # request to Symfony (improves performance but Symfony's 404 page is not displayed)
    # location /bundles {
    #     try_files $uri =404;
    # }

    location ~ ^/index\.php(/|$) {
         client_max_body_size 50m;

         fastcgi_pass php:9000;
         fastcgi_buffers 16 16k;
         fastcgi_buffer_size 32k;
         include fastcgi_params;
         fastcgi_param SCRIPT_FILENAME /usr/src/app/public/index.php;
    }

    # return 404 for all other php files not matching the front controller
    # this prevents access to other php files you don't want to be accessible.
    location ~ \.php$ {
        return 404;
    }

    error_log /var/log/nginx/project_error.log;
    access_log /var/log/nginx/project_access.log;
}

我不知道为什么我有这个而且..我需要重新启动 docker 才能让容器再次工作。

任何想法 ?问候

标签: dockercontainers

解决方案


如果您使用 Docker for Windows,尤其是像我一样使用最新的“稳定版”(2.3.0.3),您可以尝试使用stephen-turner 建议的 Docker Desktop 的 Edge 版本。或者你可以像diogoaguiar建议的那样降级。


推荐阅读