diff --git a/docker/apache/bad-configs/.htaccess b/docker/apache/bad-configs/.htaccess new file mode 100644 index 0000000..71f8f55 --- /dev/null +++ b/docker/apache/bad-configs/.htaccess @@ -0,0 +1,22 @@ +# Basic .htaccess for tkr on shared hosting +# For use with included docker-compose.yml + +# Enable mod_rewrite +RewriteEngine On + +# Set directory index +DirectoryIndex public/index.php + +# Block access to sensitive directories +RewriteRule ^(storage|src|templates|config)(/.*)?$ - [F,L] + +# Block access to hidden files +RewriteRule ^\..*$ - [F,L] + +# Block access to setup script +RewriteRule ^tkr-setup\.php$ - [F,L] + +# Route everything else through public/index.php +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)$ public/index.php [L] diff --git a/docker/apache/bad-configs/docker-compose.yml b/docker/apache/bad-configs/docker-compose.yml new file mode 100644 index 0000000..d6fa759 --- /dev/null +++ b/docker/apache/bad-configs/docker-compose.yml @@ -0,0 +1,22 @@ +services: + apache-php-no-sqlite: + image: debian:bookworm + container_name: apache-no-sqlite-test + ports: + - "80:80" + volumes: + - ./config:/var/www/html/tkr/config + - ./public:/var/www/html/tkr/public + - ./src:/var/www/html/tkr/src + - ./storage:/var/www/html/tkr/storage + - ./templates:/var/www/html/tkr/templates + - ./tkr-setup.php:/var/www/html/tkr/tkr-setup.php + - ./docker/apache/shared-hosting/.htaccess:/var/www/html/tkr/.htaccess + command: > + bash -c "apt-get update && + apt-get install -y apache2 php libapache2-mod-php && + a2enmod rewrite headers expires php8.2 && + sed -i 's/AllowOverride None/AllowOverride All/g' /etc/apache2/apache2.conf && + chown -R www-data:www-data /var/www/html/tkr/storage && + apache2ctl -D FOREGROUND" + restart: unless-stopped