twix007
@twix007

Почему nginx не видит php-fpm:9000?

Ошибка при запуске докера:
nginx: [emerg] host not found in upstream "php-fpm5.6" in /etc/nginx/conf.d/default.conf:25
WARNING: Nothing matches the include pattern '/etc/php/5.6/fpm/pool.d/*.conf' from /etc/php/5.6/fpm/php-fpm.conf at line 31.


php-fpm.conf:
[global]

error_log = /proc/self/fd/2
daemonize = no

[www]

access.log = /proc/self/fd/2

user = www-data
group = www-data

listen = [::]:9000
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

pm = dynamic
pm.max_children = 9
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 3
pm.max_requests = 200
catch_workers_output = yes
clear_env = yes

php_admin_value[sendmail_path] = /usr/local/bin/phpmailer
php_admin_value[open_basedir]= "/data:/srv:/var/tmp:/tmp"
php_admin_value[upload_tmp_dir] = "/var/tmp"

include=/etc/php/5.6/fpm/pool.d/*.conf

default.conf:
server {
listen 80;
server_name localhost;
root /var/www/html;

index index.php;

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

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}

include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

fastcgi_pass php-fpm5.6:9000;
fastcgi_index index.php;
}
}

Dockerfile:
FROM dockette/debian:stretch

# PHP
ENV PHP_MODS_DIR=/etc/php/5.6/mods-available
ENV PHP_CLI_DIR=/etc/php/5.6/cli
ENV PHP_CLI_CONF_DIR=${PHP_CLI_DIR}/conf.d
ENV PHP_CGI_DIR=/etc/php/5.6/cgi
ENV PHP_CGI_CONF_DIR=${PHP_CGI_DIR}/conf.d
ENV PHP_FPM_DIR=/etc/php/5.6/fpm
ENV PHP_FPM_CONF_DIR=${PHP_FPM_DIR}/conf.d
ENV PHP_FPM_POOL_DIR=${PHP_FPM_DIR}/pool.d
ENV TZ=Europe/Kiev

# INSTALLATION
RUN apt-get update && apt-get dist-upgrade -y && \
# DEPENDENCIES #############################################################
apt-get install -y wget curl apt-transport-https ca-certificates git unzip && \
# PHP DEB.SURY.CZ ##########################################################
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \
echo "deb https://packages.sury.org/php/ stretch main" > /etc/apt/sources.list.d/php.list && \
apt update && \
apt install -y --no-install-recommends \
php5.6-apc \
php5.6-apcu \
php5.6-bcmath \
php5.6-bz2 \
php5.6-calendar \
php5.6-cgi \
php5.6-cli \
php5.6-ctype \
php5.6-curl \
php5.6-fpm \
php5.6-geoip \
php5.6-gettext \
php5.6-gd \
php5.6-intl \
php5.6-imagick \
php5.6-imap \
php5.6-ldap \
php5.6-mbstring \
php5.6-mcrypt \
php5.6-memcached \
php5.6-mongo \
php5.6-mysql \
php5.6-pdo \
php5.6-pgsql \
php5.6-redis \
php5.6-soap \
php5.6-sqlite3 \
php5.6-ssh2 \
php5.6-zip \
php5.6-xmlrpc \
php5.6-xsl && \
# COMPOSER #################################################################
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
composer global require "hirak/prestissimo:^0.3" && \
# PHP MOD(s) ###############################################################
ln -s ${PHP_MODS_DIR}/custom.ini ${PHP_CLI_CONF_DIR}/999-custom.ini && \
ln -s ${PHP_MODS_DIR}/custom.ini ${PHP_CGI_CONF_DIR}/999-custom.ini && \
ln -s ${PHP_MODS_DIR}/custom.ini ${PHP_FPM_CONF_DIR}/999-custom.ini && \
# CLEAN UP #################################################################
rm ${PHP_FPM_POOL_DIR}/www.conf && \
apt-get clean -y && \
apt-get autoclean -y && \
apt-get remove -y wget curl && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* /var/lib/log/* /tmp/* /var/tmp/*

# FILES (it overrides originals)
ADD custom.ini ${PHP_MODS_DIR}/custom.ini
ADD php-fpm.conf ${PHP_FPM_DIR}/php-fpm.conf

# WORKDIR
WORKDIR /var/www/html

# Expose port 9000 and start php-fpm server
EXPOSE 9000
# COMMAND
CMD ["php-fpm5.6"]
  • Вопрос задан
  • 1897 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы