docker alpine nginx php7.2无法运行

时间:2019-03-11 16:21:21

标签: docker nginx alpine

我正在尝试使用Alpine + nginx + php7.2构建带有堆栈的容器,但是我无法正确地做到这一点。当前消息是

This page isn’t working localhost didn’t send any data.
ERR_EMPTY_RESPONSE

这是我的dockfile代码,我尝试使用两个基本映像,一个是nginx-alpine,另一个是php72-fpm

From nginx:alpine

RUN set -x \
    && addgroup -g 1000 -S www-data \
    && adduser -u 1000 -D -S -G www-data www-data

WORKDIR /var/www/html
RUN chown -R www-data:www-data /var/log/nginx && chown -R www-data:www-data /var/www/html

From php:7.2-fpm-alpine

RUN apk update && apk upgrade

RUN apk add git curl

RUN apk --no-cache add php7-pgsql php7-json php7-openssl php7-curl \
    php7-zlib php7-xml php7-phar php7-intl php7-dom php7-xmlreader php7-xmlwriter php7-ctype \
    php7-simplexml php7-mbstring php7-tokenizer php7-gd supervisor

COPY docker/nginx/nginx.conf /etc/nginx/conf.d/default.conf

WORKDIR /var/www/html
COPY . /var/www/html

EXPOSE 80 443

还有我试图用来覆盖默认conf的nginx.conf

server {
    listen 80;

    client_max_body_size 18M;

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

    root /var/www/html/public;

    index index.php;

    if (!-e $request_filename) {
        rewrite ^.*$ /index.php last;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }


    location / {
         try_files $uri $uri/ /index.php$is_args$args;
    }
}

感谢帮助!

0 个答案:

没有答案