Добрый день.
Возникла проблема на рабочем сервере.
Создал образ docker на локальном, выгрузил на сервер.
Естественно сайт не запустился.
В логах docker на сервере ошибка
docker logs cont-nginx_1
/docker-entrypoint.sh: Configuration complete; ready for start up
2020/12/28 13:38:57 [emerg] 1#1: open() "/etc/nginx/fastcgi-params" failed (2: No such file or directory) in /etc/nginx/conf.d/default.conf:26
nginx: [emerg] open() "/etc/nginx/fastcgi-params" failed (2: No such file or directory) in /etc/nginx/conf.d/default.conf:26
Если посмотреть логи docker на локальном, то никакой ошибки нет и всё работает.
docker logs cont-nginx_1
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf differs from the packaged version
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
Образ собирался из
nginx:1.19-alpine
Конфигурация nginx
server{
listen 80;
server_name _;
index index.php index.html;
root /app/public;
charset utf-8;
add_header X-Frame-Options "SAMEORIGIN";
location ~* \.(?:ico|gif|jpe?g|png|woff2?|eot|otf|ttf|svg|js|css)$ {
access_log off;
expires max;
add_header Pragma public;
add_header Cache-Control "public";
try_files $uri /index.php?$args;
}
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass pohoron-php-fpm:9000;
fastcgi_index index.php;
include fastcgi-params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
Куда пропал fastcgi-params? Как исправить ситуацию?
UPD
docker build --pull --file=site/docker/production/nginx.docker --tag ${REGISTRY_ADDRESS}:nginx-${IMAGE_TAG} site
docker push ${REGISTRY_ADDRESS}:nginx-${IMAGE_TAG}
scp -o StrictHostKeyChecking=no ${PORDUCTION_PORT} docker-compose-production.yml ${PRODUCTION_HOST}:docker-compose.yml
ssh -o StrictHostKeyChecking=no ${PRODUCTION_HOST} -p ${PRODUCTION_PORT} 'docker-compose pull'
ssh -o StrictHostKeyChecking=no ${PRODUCTION_HOST} -p ${PRODUCTION_PORT} 'docker-compose up --build -d'
docker-compose-production.yml
version: '3'
services:
site-nginx:
image: ${REGISTRY_ADDRESS}:nginx-${IMAGE_TAG}
restart: always
depends_on:
- site-php-fpm
ports:
- "80:80"
site-php-fpm:
image: ${REGISTRY_ADDRESS}:php-fpm-${IMAGE_TAG}
restart: always
environment:
DATABASE_URL: pgsql://app:${DB_PASSWORD}@site-postgres:5432/app
OAUTH_FACEBOOK_SERCRET: ${OAUTH_FACEBOOK_SECRET}
REDIS_URL: tcp://site-redis:6379?password=${REDIS_PASSWORD}
MAILER_URL: null://localhost
depends_on:
- site-postgres
- site-redis
site-redis:
image: ${REGISTRY_ADDRESS}:redis-${IMAGE_TAG}
restart: always
volumes:
- site-redis:/data
command: redis-server --requirepass ${REDIS_PASSWORD}
volumes:
site-postgres:
site-redis:
nginx-docker
FROM nginx:1.19-alpine
COPY ./docker/production/nginx/conf.d /etc/nginx/conf.d
WORKDIR /app
COPY ./public ./public
COPY --from=node-builder /app/public/build ./public/build