簡體   English   中英

在 docker laravel php-fpm nginx 上使用 umask 0 創建會話

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

我的 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

瀏覽器錯誤

 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

[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

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"]

知道問題可能出在哪里嗎?

必須在主管配置 002 上為 php-fpm 和 nginx 添加 umask;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM