Permission Issue and Directory Index Error in Dockerized CodeIgniter Project

I have created a new CodeIgniter project and am in the process of setting up a container for it. However, after creating the container, I am encountering the following issue:


You don’t have permission to access this resource. Upon reviewing the logs, I noticed the following error message: AH01276: Cannot serve directory /var/www/html/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by the Options directive. I am seeking assistance with this problem, as I am new to Docker.

my docker file

# Use the official PHP image as the base image

FROM php:7.4-apache

# Set the working directory inside the container

WORKDIR /var/www/html

# Copy the CodeIgniter project files to the container

COPY . .

# Install required PHP extensions and enable Apache modules

RUN docker-php-ext-install mysqli pdo pdo_mysql

RUN a2enmod rewrite

# Expose port 80 for Apache


Is there any index.php or index.html in the container in tha mentioned folder? Have you checked that?

I also fixed your shared Dockerfile. Please, format your posts according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

1 Like