|
|
@@ -15,10 +15,25 @@ RUN composer install --no-dev --no-interaction --prefer-dist --no-progress
|
|
|
|
|
|
COPY . .
|
|
|
|
|
|
+# Write a clean Apache site config pointing at public/ and routing every
|
|
|
+# unmatched URL to the front controller via FallbackResource. That replaces
|
|
|
+# the need for .htaccess rewrites (the .htaccess is kept as defense-in-depth
|
|
|
+# for deployments that don't use this image).
|
|
|
RUN mkdir -p /var/www/data /var/www/data/sessions \
|
|
|
&& chown -R www-data:www-data /var/www/data \
|
|
|
- && sed -ri 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/000-default.conf \
|
|
|
- && sed -ri 's!/var/www/!/var/www/html/public!g' /etc/apache2/apache2.conf
|
|
|
+ && printf '%s\n' \
|
|
|
+ '<VirtualHost *:80>' \
|
|
|
+ ' DocumentRoot /var/www/html/public' \
|
|
|
+ ' <Directory /var/www/html/public>' \
|
|
|
+ ' Options -Indexes +FollowSymLinks' \
|
|
|
+ ' AllowOverride All' \
|
|
|
+ ' Require all granted' \
|
|
|
+ ' FallbackResource /index.php' \
|
|
|
+ ' </Directory>' \
|
|
|
+ ' ErrorLog ${APACHE_LOG_DIR}/error.log' \
|
|
|
+ ' CustomLog ${APACHE_LOG_DIR}/access.log combined' \
|
|
|
+ '</VirtualHost>' \
|
|
|
+ > /etc/apache2/sites-available/000-default.conf
|
|
|
|
|
|
EXPOSE 80
|
|
|
CMD ["apache2-foreground"]
|