After almost 1 hour of trying I asked GPT and found out that I need .htaccess if I use Apache
RewriteEngine On
RewriteBase /
# If the request is not for a valid file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all other requests to index.php
RewriteRule ^ index.php [L]
also, mod_rewrite needs to be enabled as well as .htaccess allowed to override settings. Therefore, I created a Dockerfile
FROM php:8.2-apache
# Enable Apache mod_rewrite
RUN a2enmod rewrite
# Allow .htaccess to override settings
RUN sed -i 's|AllowOverride None|AllowOverride All|' /etc/apache2/apache2.conf
The new docker compose file is now using the Dockerfile to build the image
services:
php:
build: .
ports:
- "8080:80"
volumes:
- ./:/var/www/html
docker compose up -d --build