简体   繁体   English

在 docker laravel php-fpm nginx 上使用 umask 0 创建会话

[英]sesion being created with umask 0 on docker laravel php-fpm nginx

Sessions on my laravel app are being created without any permission generating the following error我的 laravel 应用程序上的会话在没有任何权限的情况下被创建,产生以下错误

root@737be173d2b4:/var/www/storage/framework/sessions# ls -la
total 32
drwxr-xr-x    1 nginx    nginx         4096 Feb 20 15:11 .
drwxr-xr-x    1 nginx    nginx         4096 Feb 20 12:06 ..
-rwxr-xr-x    1 nginx    nginx           14 Feb 15 15:29 .gitignore
----------    1 nginx    nginx          174 Feb 20 15:11 60wt62YDJTRKixZYJn7vW4Eh8D8mbYLsZZDt2uP3
----------    1 nginx    nginx          174 Feb 20 15:10 C5omhm8W59rC4TxkHPIxiMfYS8KmsTkDnZlO77sp
----------    1 nginx    nginx          174 Feb 20 14:46 RnIVkM9GccDc0t9opNEqoUk1riP5SNIGUDM8Q5nm
-rwxr-xr-x    1 nginx    nginx          185 Feb 18 22:59 cToEfrP95tnDvbc06ktHzzkXDFXXuPPdcTSLgmvH

browser error浏览器错误

 M-( fopen(/var/www/storage/framework/sessions/60wt62YDJTRKixZYJn7vW4Eh8D8mbYLsZZDt2uP3): failed to open stre.. (p1 of 4)
 am: Permission denied in file /var/www/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php on line 70

 #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'fopen(/var/www/...', '/var/www/vendor...', 70, Array)
 #1 /var/www/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(70): fopen('/var/www/storag...', 'rb')
 #2 /var/www/vendor/laravel/framework/src/Illuminate/Session/FileSessionHandler.php(71): Illuminate\Filesystem\Filesystem
 (...)

www.conf www.conf

[global]
daemonize = no
[www]
user = nginx
group = nginx
listen = /var/run/php-fpm.sock
listen.mode = 0666
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

dockerfile dockerfile

FROM php:7.4-fpm-alpine
RUN apk add bash \
            nginx \
            php7-mbstring \
            composer \
            git \
            openssh-client \
            supervisor
COPY ops/.bashrc /root
COPY ops/supervisord.conf /etc
COPY ops/nginx.conf /etc/nginx/conf.d/default.conf
COPY ops/fpm.conf /usr/local/etc/php-fpm.d/www.conf
RUN mkdir -p /run/nginx
RUN chown nginx:nginx /run/nginx
RUN rm /usr/local/etc/php-fpm.d/zz-docker.conf
RUN rm -rf /var/www/*
COPY --chown=nginx:nginx . /var/www
WORKDIR /var/www
RUN composer install
CMD ["supervisord", "-n", "-c", "/etc/supervisord.conf", "-l", "/var/log/supervisord.log", "-j", "/var/run/supervisord.pid"]

Any idea where the problem might be?知道问题可能出在哪里吗?

Had to add umask on supervisor config 002 for php-fpm and nginx;必须在主管配置 002 上为 php-fpm 和 nginx 添加 umask;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM