Php 权限被拒绝Nginx Docker
我正在使用docker compose启动一个开发工作区,由php、nginx和mysql组成。一切启动,静态html得到服务,但当尝试启动laravel应用程序时,我得到以下错误: 无法打开流或文件“/home/html/storage/logs/laravel-2019-06-10.log”:无法打开流:权限被拒绝 我四处搜索,发现好像是权限问题?请注意,只有数据库和内置php服务器的docker似乎可以工作 我的docker-compose.ymlPhp 权限被拒绝Nginx Docker,php,laravel,docker,nginx,Php,Laravel,Docker,Nginx,我正在使用docker compose启动一个开发工作区,由php、nginx和mysql组成。一切启动,静态html得到服务,但当尝试启动laravel应用程序时,我得到以下错误: 无法打开流或文件“/home/html/storage/logs/laravel-2019-06-10.log”:无法打开流:权限被拒绝 我四处搜索,发现好像是权限问题?请注意,只有数据库和内置php服务器的docker似乎可以工作 我的docker-compose.yml version: "3" service
version: "3"
services:
db:
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: "root"
ports:
- 3306:3306
php-fpm:
image: php:7.3-fpm-alpine
links:
- db
volumes:
- "./:/home/html/"
nginx:
image: nginx:1-alpine
ports:
- "8080:80"
links:
- php-fpm
volumes:
- "./site.conf:/etc/nginx/conf.d/default.conf"
- "./:/home/html/"
我的nginx配置:
server {
index index.php index.html;
listen 80 default_server;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /home/html/public;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 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的帐户可以访问日志文件夹ID您尝试更改文件夹权限吗?文件夹权限应该有效。我的第一个设置是使用php-S服务器,这很有效。但是我会检查它们以确保文件夹权限是755,因此除了必须为目录分配owner:group的权限之外,它还应该是好的。类似于
chown-R$USER:www-data./storage
或chown-R$USER:http./storage
,