dongwen7283 2019-06-10 15:24
浏览 1083

权限被拒绝Nginx Docker

I'm using docker compose to boot up a development workspace, consisting of php, nginx and mysql. Everything boots, static html get's served, but when trying to start a laravel app, i get the following error:

The stream or file "/home/html/storage/logs/laravel-2019-06-10.log" could not be opened: failed to open stream: Permission denied

I searched around and it looked like a permissions issue? Do note, that the docker with just the database and the build in php server does seem to work.

My docker-compose.yml

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

My nginx config:

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;
    }
}

Kind regards :)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
    • ¥15 让node服务器有自动加载文件的功能
    • ¥15 jmeter脚本回放有的是对的有的是错的
    • ¥15 r语言蛋白组学相关问题
    • ¥15 Python时间序列如何拟合疏系数模型