Laravel не отправляет ответ Set-cookie, поэтому cookie-файл сеанса Laravel не сохраняется в браузере. Для сеанса установлен файловый адаптер, и файлы создаются успешно с правильными разрешениями.
Я установил конфигурацию сеанса Laravel на конфигурацию по умолчанию, поставляемую с Laravel.
Я используюLaravel Framework 5.5.48.
Может ли кто-нибудь оказать какую-либо помощь?
docker-compose.yml
version: '3'
services:
app:
build:
context: ./
dockerfile: app.dockerfile
working_dir: /var/www
volumes:
- ./src:/var/www
environment:
- "DB_PORT=3306"
- "DB_HOST=database"
ports:
- "9000:9000"
networks:
- t-network
web:
build:
context: ./
dockerfile: web.dockerfile
working_dir: /var/www
volumes:
- ./src:/var/www
ports:
- "80:80"
- "443:443"
networks:
- t-network
database:
image: mysql:5.7
volumes:
- dbdata:/var/lib/mysql
environment:
- "MYSQL_DATABASE=t"
- "MYSQL_USER=homestead"
- "MYSQL_PASSWORD=secret"
- "MYSQL_ROOT_PASSWORD=secret"
ports:
- "33060:3306"
networks:
- t-network
volumes:
dbdata:
networks:
t-network:
vhost.conf
server {
listen 80;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/public;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app: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?$query_string;
gzip_static on;
}
}
app.dockerfile
FROM php:7.2-fpm
# Copy composer.lock and composer.json
COPY ./src/composer.json /var/www/
# Set working directory
WORKDIR /var/www
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
locales \
zip \
jpegoptim optipng pngquant gifsicle \
vim \
unzip \
git \
curl \
xvfb \
libfontconfig \
wkhtmltopdf
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install extensions
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Add user for laravel application
RUN groupadd -g 1000 www
RUN useradd -u 1000 -ms /bin/bash -g www www
# Copy existing application directory contents
COPY ./src /var/www
# Copy existing application directory permissions
COPY --chown=www:www . /var/www
RUN chown -R www:www /tmp
RUN chmod -R 777 /tmp
# Change current user to www
USER www
# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]
web.dockerfile
FROM nginx:1.17
ADD vhost.conf /etc/nginx/conf.d/default.conf