【问题标题】:Laravel Apache and Docker Permission DeniedLaravel Apache 和 Docker 权限被拒绝
【发布时间】:2020-03-19 23:21:38
【问题描述】:

大家好,

我收到了这个错误

我不明白,我检查了 Apache 和 docker-compose 中的路径。
我检查有关 laravel 键入 php artisan 的正确安装


我正确打开了我的 phpinfo (blog/info.php) 文件和我的 test2.php (blog/public/test2.php) 文件
我试图将权限 777 设置为我的 docker 容器内的所有文件和目录,但没有。
我想看看正确的laravel安装基础页面并开始研究这个框架。

这是我的 Apache 配置文件:

    <VirtualHost *:80>
    ServerName foxsimracing
    DocumentRoot /var/www/html/public
    ErrorLog /var/log/httpd/error.log
    Options Indexes FollowSymLinks
    ServerAdmin email@example.com

    <Directory /var/www/html/public>
        AllowOverride all

        <IfVersion < 2.4>
            Allow from all
        </IfVersion>

        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
    </Directory>
</VirtualHost>

这是我的 Dockerfile

FROM php:7.2-apache
RUN apt-get update
RUN apt-get install -y apt-utils zip unzip
RUN apt-get install -y vim
RUN docker-php-ext-install pdo_mysql mysqli bcmath

# Installing xdebug
RUN pecl install xdebug
RUN docker-php-ext-enable xdebug

# Installing composer
RUN curl -sS https://getcomposer.org/installer | php

RUN useradd -o -u 1000 -g www-data -m -s /bin/bash www
RUN chown -R www-data:www-data /var/www

# Clean up APT when done.
RUN apt-get autoremove -y
WORKDIR /var/www/html/
EXPOSE 80

这是我的 docker-compose 文件

version: '3'

services:
foxsimracing_app:
    build:
        context: ./foxsimracing_app
        dockerfile: Dockerfile
    container_name: foxsimracing_app
    ports:
        - "8080:80"
    volumes:
        - ./foxsimracing_app/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
        - ./foxsimracing_app/custom.conf:/etc/apache2/sites-available/custom.conf
        - ../../repo/foxsimracinghardware/blog:/var/www/html
    networks:
        - laravel
    depends_on:
        - mysql

mysql:
    image: mysql:5.7.29
    container_name: foxsimracing_mysql
    restart: unless-stopped
    tty: true
    ports:
        - 3306:3306
    volumes:
        - ./mysql:/var/lib/mysql
    environment:
        MYSQL_DATABASE: foxsimracing
        MYSQL_USER: simracing
        MYSQL_PASSWORD: simracing
        MYSQL_ROOT_PASSWORD: root
    networks:
        - laravel

phpmyadmin:
    container_name: foxsimracing_phpmyadmin
    image: phpmyadmin/phpmyadmin
    ports:
        - "8088:80"
    environment:
        PMA_HOST: mysql
        MYSQL_ROOT_PASSWORD: root
    depends_on:
        - mysql
    networks:
        - laravel

networks:
laravel:

我在 laravel 应用中的 .env 文件

APP_NAME=foxsimracing
APP_ENV=local
APP_KEY=base64:/JPnIdjIdzyxw4N85h2Bl13K3m9qHoO//SPoMxqBfq4=
APP_DEBUG=true
APP_URL=http://localhost

有人可以帮帮我吗?

【问题讨论】:

    标签: laravel docker permission-denied


    【解决方案1】:

    我终于发现问题出在 apache 配置中。
    我把它放在 /etc/apache2/sites-available 中,这是错误的,因为我必须把它放在 /etc/apache2/sites-enabled 中。
    我搬进了 /etc/apache2/sites-enabled ,它的工作! 我希望这对其他人有帮助。

    【讨论】:

      猜你喜欢
      • 2022-01-18
      • 2018-12-15
      • 2012-08-13
      • 2016-04-13
      • 2023-03-22
      • 2020-07-21
      • 2014-06-29
      相关资源
      最近更新 更多